- Simple Mail Transfer Protocol (SMTP).
The mailboxes may be accessed and managed by users with the
- Post Office Protocol (POP) or the
- Internet Message Access Protocol (IMAP).
A mail server uses the Domain Name System (DNS) to locate the destination mail server for the domain of the recipient by querying for mail exchanger records (MX records).
To indicate the message recipient, an email address also may have an associated display name for the recipient, which is followed by the address specification surrounded by angled brackets, for example:
John Smith <john.smith@example.org>
.The format of email addresses is
local-part@domain
where the local-part may be up to 64 characters long and the domain name
may have a maximum of 253 characters – but the maximum of 256-character
length of a forward or reverse path restricts the entire email address
to be no more than 254 characters long. The general format of an email address is localpart@domain"
- local part,
- @ symbol
- domain part.
Local part
- may use any of these ASCII characters
- Uppercase and lowercase English letters (a–z, A–Z) (ASCII: 65–90, 97–122)
- Digits
0
to9
(ASCII: 48–57) - These special characters:
! # $ % & ' * + - / = ? ^ _ ` { | } ~
(limited support) - Character
.
( not the first or last character, not appear two or more times consecutively) - only one @ is allowed outside quotation marks
- Not allowed:
- Space and
"(),:;<>@[\]
(ASCII: 32, 34, 40, 41, 44, 58, 59, 60, 62, 64, 91–93) - Character
.
on first or last character, appear two or more times consecutively - many @ outside quotation marks
- Space and
Technically all other local-parts are case-sensitive, however, many organizations treat uppercase and lowercase letters as equivalent.
In practice, the mail system at example.com may choose to treat John.Smith as equivalent john.smith or even johnsmith.
Domain part
- it must match the requirements for a hostname,
- consisting of letters, digits, hyphens and dots.
Basic validate expression:
The regular expression used in the example code:
[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}
is one of the simplest possible. In a lot of cases this simple expression is good enough. It consists of five parts:
1. | [A-Z0-9._%+-]+ | the first part of mail address may contain all characters, numbers, points, underscores, percent, plus and minus. |
2. | @ | the @ character is mandatory |
3. | [A-Z0-9.-]+ | the second part of mail address may contain all characters, numbers, points, underscores. |
4. | \\. | the point is mandatory |
5. | [A-Z]{2,4} | the domain name may contain all characters. The number of characters is limited between 2 and 4. |
http://www.sw-engineering-candies.com/blog-1/howtofindvalidemailaddresswitharegularexpressionregexinjava
http://fightingforalostcause.net/content/misc/2006/compare-email-regex.php
http://regexlib.com/DisplayPatterns.aspx?AspxAutoDetectCookieSupport=1
http://ex-parrot.com/~pdw/Mail-RFC822-Address.html
http://www.mkyong.com/regular-expressions/how-to-validate-email-address-with-regular-expression/
http://www.regular-expressions.info/email.html
http://en.wikipedia.org/wiki/Email
http://en.wikipedia.org/wiki/Email_address
http://www.regular-expressions.info/email.html
Brak komentarzy:
Prześlij komentarz