Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the format of email header "name <email>"?

What is the official format of

name <email>

in email headers? I need to validate user input before pasting it into my headers.

Also, do you happen to know good Regular Expressions to validate that form of name+email pair?

like image 278
Tower Avatar asked Apr 13 '10 15:04

Tower


1 Answers

Enjoy.

Search stackoverflow for regexes to parse email addresses, you'll quickly see it's futile.

You should probably just do some basic sanity checking and actually attempt to email the name, address pair as you main way of checking if the email is valid.

like image 58
Ben S Avatar answered Oct 19 '22 02:10

Ben S