@@ -4,12 +4,35 @@ email\_validator
4
4
A robust email address syntax and deliverability validation library
5
5
for Python 2.7/3.4 by `Joshua Tauberer <https://razor.occams.info >`__.
6
6
7
- This library validates that address are of the form like ``x@y.com ``,
8
- e.g. what you would want in a login form on a website. There are other
9
- forms of email addresses, like you would use when composing a message's
10
- To: line e.g. ``My Name <my@address.com> ``, that this library does not
11
- accept. For that try `flanker <https://github.com/mailgun/flanker >`__
12
- instead.
7
+ This library validates that address are of the form ``x@y.com ``. This is
8
+ the sort of validation you would want for a login form on a website.
9
+
10
+ Key features:
11
+
12
+ * Good for validating email addresses used for logins/identity.
13
+ * Friendly error messages when validation fails (appropriate to show to end users).
14
+ * Checks deliverability: Does the domain name resolve?
15
+ * Supports internationalized domain names and, with a flag, internationalized local parts.
16
+ * Normalizes email addresses (super import for internationalized addresses).
17
+
18
+ The library is NOT for validation of an email's To: line (e.g.
19
+ ``My Name <my@address.com> ``), which `flanker <https://github.com/mailgun/flanker >`__
20
+ is more appropriate for. And this library does NOT permit obsolete
21
+ forms of email addresses, so if you need strict validation against the
22
+ email specs exactly, use `pyIsEmail <https://github.com/michaelherold/pyIsEmail >`__.
23
+
24
+ The current version is 1.0 (September 5, 2015).
25
+
26
+ Installation
27
+ ------------
28
+
29
+ This package is on PyPI, so:
30
+
31
+ ::
32
+
33
+ pip install email_validator
34
+
35
+ ``pip3 `` also works.
13
36
14
37
Usage
15
38
-----
@@ -67,12 +90,12 @@ turn is a subclass of ``ValueError``.
67
90
But when an email address is valid, a dict is returned containing
68
91
information that might aid deliverability (see below).
69
92
70
- The validator doesn't permit obsoleted forms of email addresses that no one,
93
+ The validator doesn't permit obsoleted forms of email addresses that no one
71
94
uses anymore even though they are still valid and deliverable, since they
72
- will probably give you grief if you're using email for login. See later in the
73
- document about that. If you need validation against the specs exactly,
74
- you might like `pyIsEmail <https://github.com/michaelherold/pyIsEmail >`__.
95
+ will probably give you grief if you're using email for login. (See later in the
96
+ document about that.)
75
97
98
+ The validator checks that the domain name in the email address resolves.
76
99
There is nothing to be gained by trying to actually contact an SMTP
77
100
server, so that's not done here. For privacy, security, and practicality
78
101
reasons servers are good at not giving away whether an address is
@@ -104,7 +127,8 @@ respectively. Each has adapted to internationalization in a separate
104
127
way, creating two separate aspects to email address
105
128
internationalization.
106
129
107
- ### Internationalized domain names (IDN)
130
+ Internationalized domain names (IDN)
131
+ ''''''''''''''''''''''''''''''''''''
108
132
109
133
The first is `internationalized domain names (RFC
110
134
5891) <https://tools.ietf.org/html/rfc5891> `__. The DNS system has not
@@ -118,7 +142,8 @@ in transition between IDNA 2003 (RFC 3490) and IDNA 2008 (RFC 5891). This
118
142
library uses IDNA 2008 using the `idna <https://github.com/kjd/idna >`__
119
143
module by Kim Davies.
120
144
121
- ### Internationalized local parts
145
+ Internationalized local parts
146
+ '''''''''''''''''''''''''''''
122
147
123
148
The second sort of internationalization is internationalization in the
124
149
*local * part of the address (before the @-sign). These email addresses
@@ -128,7 +153,8 @@ support the `SMTPUTF8 (RFC
128
153
6531) <https://tools.ietf.org/html/rfc6531> `__ extension. Support for
129
154
SMTPUTF8 varies.
130
155
131
- ### How this module works
156
+ How this module works
157
+ '''''''''''''''''''''
132
158
133
159
By default all internationalized forms are accepted by the validator.
134
160
But if you know ahead of time that SMTPUTF8 is not supported by your
0 commit comments