Email address format
Solved
boubou08
Posted messages
87
Status
Membre
-
céline03 -
céline03 -
Hello everyone,
Does anyone have a website or a document that describes the format of an email address, the rules regarding the address format (firstname.lastname@site.com)
Thank you and see you soon.
Does anyone have a website or a document that describes the format of an email address, the rules regarding the address format (firstname.lastname@site.com)
Thank you and see you soon.
5 réponses
The precise specification is in paragraph 6.1 of RFC 822:
http://ietf.org/rfc/rfc0822.txt
But to put it more simply:
Allowed characters: a-z 0-9 . _ -
(case insensitive)
followed by the at sign (@)
followed by an existing domain name or subdomain (same allowed characters).
http://ietf.org/rfc/rfc0822.txt
But to put it more simply:
Allowed characters: a-z 0-9 . _ -
(case insensitive)
followed by the at sign (@)
followed by an existing domain name or subdomain (same allowed characters).
Hello,
And does anyone have a PHP mask to validate this kind of addresses?
I made an attempt that I was satisfied with using XSS software and manual attempts
but it seems that a clever spammer managed to get me...
Here is my attempt to correct:
And does anyone have a PHP mask to validate this kind of addresses?
I made an attempt that I was satisfied with using XSS software and manual attempts
but it seems that a clever spammer managed to get me...
Here is my attempt to correct:
$ident = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; $regex = '/^'.$ident.'+'.'(\.'.$ident.'+)*'.'@'.'('.$domain.'{1,63}\.)+'.$domain.'{2,63}$/i'; if (preg_match($regex, $mail)==false) { return false; } else { return true; }
Attention, RFC822 is NOT the current RFC for an email address.
https://tools.ietf.org/html/rfc3696
and its erratum:
http://www.rfc-editor.org/cgi-bin/errataSearch.pl?rfc=3696
Basically, for everything before the @, the following are allowed:
- letters (uppercase AND lowercase, but it's the server that decides whether it distinguishes or not)
- numbers
- characters ! # $ % & ' * + - / = ? ^ _ ` . { | } ~
Thus, Finances/pole_S&P/Jean.Valjean*flashbang*6+4=10@montfermeil.les-miserables.com is a VALID address.
It is even possible to use spaces and \ by using quotes: "Jean Valjean"@les-miserables.com is a valid email address.
https://tools.ietf.org/html/rfc3696
and its erratum:
http://www.rfc-editor.org/cgi-bin/errataSearch.pl?rfc=3696
Basically, for everything before the @, the following are allowed:
- letters (uppercase AND lowercase, but it's the server that decides whether it distinguishes or not)
- numbers
- characters ! # $ % & ' * + - / = ? ^ _ ` . { | } ~
Thus, Finances/pole_S&P/Jean.Valjean*flashbang*6+4=10@montfermeil.les-miserables.com is a VALID address.
It is even possible to use spaces and \ by using quotes: "Jean Valjean"@les-miserables.com is a valid email address.
Have a nice day and thanks again for the quick response.