You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -42,7 +45,7 @@ This package [is on PyPI](https://pypi.org/project/email-validator/), so:
42
45
pip install email-validator
43
46
```
44
47
45
-
`pip3`also works.
48
+
(You might need to use `pip3`depending on your local environment.)
46
49
47
50
Quick Start
48
51
-----------
@@ -82,8 +85,7 @@ Usage
82
85
### Overview
83
86
84
87
The module provides a function `validate_email(email_address)` which
85
-
takes an email address (either a `str` or `bytes`, but only non-internationalized
86
-
addresses are allowed when passing a `bytes`) and:
88
+
takes an email address and:
87
89
88
90
- Raises a `EmailNotValidError` with a helpful, human-readable error
89
91
message explaining why the email address is not valid, or
@@ -121,18 +123,19 @@ greylisting).
121
123
The `validate_email` function also accepts the following keyword arguments
122
124
(defaults are as shown below):
123
125
126
+
`check_deliverability=True`: If true, a DNS query is made to check that a non-null MX record is present for the domain-part of the email address (or if not, an A/AAAA record as an MX fallback can be present but in that case a reject-all SPF record must not be present). Set to `False` to skip this DNS-based check. DNS is slow and sometimes unavailable, so consider whether these checks are useful for your use case. It is recommended to pass `False` when performing validation for login pages (but not account creation pages) since re-validation of a previously validated domain in your database by querying DNS at every login is probably undesirable. You can also set `email_validator.CHECK_DELIVERABILITY` to `False` to turn this off for all calls by default.
127
+
128
+
`dns_resolver=None`: Pass an instance of [dns.resolver.Resolver](https://dnspython.readthedocs.io/en/latest/resolver-class.html) to control the DNS resolver including setting a timeout and [a cache](https://dnspython.readthedocs.io/en/latest/resolver-caching.html). The `caching_resolver` function shown above is a helper function to construct a dns.resolver.Resolver with a [LRUCache](https://dnspython.readthedocs.io/en/latest/resolver-caching.html#dns.resolver.LRUCache). Reuse the same resolver instance across calls to `validate_email` to make use of the cache.
129
+
130
+
`test_environment=False`: DNS-based deliverability checks are disabled and `test` and `subdomain.test` domain names are permitted (see below). You can also set `email_validator.TEST_ENVIRONMENT` to `True` to turn it on for all calls by default.
131
+
124
132
`allow_smtputf8=True`: Set to `False` to prohibit internationalized addresses that would
125
133
require the
126
134
[SMTPUTF8](https://tools.ietf.org/html/rfc6531) extension. You can also set `email_validator.ALLOW_SMTPUTF8` to `False` to turn it off for all calls by default.
127
135
128
-
`check_deliverability=True`: If true, a DNS query is made to check that a non-null MX record is present for the domain-part of the email address (or if not, an A/AAAA record as an MX fallback can be present but in that case a reject-all SPF record must not be present). Set to `False` to skip this DNS-based check. DNS is slow and sometimes unavailable, so consider whether these checks are useful for your use case. It is recommended to pass `False` when performing validation for login pages (but not account creation pages) since re-validation of a previously validated domain in your database by querying DNS at every login is probably undesirable. You can also set `email_validator.CHECK_DELIVERABILITY` to `False` to turn this off for all calls by default.
129
-
130
136
`allow_empty_local=False`: Set to `True` to allow an empty local part (i.e.
131
137
`@example.com`), e.g. for validating Postfix aliases.
132
138
133
-
`dns_resolver=None`: Pass an instance of [dns.resolver.Resolver](https://dnspython.readthedocs.io/en/latest/resolver-class.html) to control the DNS resolver including setting a timeout and [a cache](https://dnspython.readthedocs.io/en/latest/resolver-caching.html). The `caching_resolver` function shown above is a helper function to construct a dns.resolver.Resolver with a [LRUCache](https://dnspython.readthedocs.io/en/latest/resolver-caching.html#dns.resolver.LRUCache). Reuse the same resolver instance across calls to `validate_email` to make use of the cache.
134
-
135
-
`test_environment=False`: DNS-based deliverability checks are disabled and `test` and `subdomain.test` domain names are permitted (see below). You can also set `email_validator.TEST_ENVIRONMENT` to `True` to turn it on for all calls by default.
136
139
137
140
### DNS timeout and cache
138
141
@@ -180,13 +183,8 @@ domain names are converted into a special IDNA ASCII "[Punycode](https://www.rfc
180
183
form starting with `xn--`. When an email address has non-ASCII
181
184
characters in its domain part, the domain part is replaced with its IDNA
182
185
ASCII equivalent form in the process of mail transmission. Your mail
183
-
submission library probably does this for you transparently. Note that
184
-
most web browsers are currently in transition between IDNA 2003 (RFC
185
-
3490) and IDNA 2008 (RFC 5891) and [compliance around the web is not
0 commit comments