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
#may not take into account Unicode normalization).
88
+
email =validation.email
85
89
except EmailNotValidError as e:
86
-
# email is not valid, exception message is human-readable
90
+
# Email is not valid.
91
+
# The exception message is human-readable.
87
92
print(str(e))
88
93
```
89
94
90
95
This validates the address and gives you its normalized form. You should
91
96
**put the normalized form in your database** and always normalize before
92
-
checking if an address is in your database.
93
-
94
-
The validator will accept internationalized email addresses, but not all
95
-
mail systems can send email to an addresses with non-English characters in
96
-
the *local* part of the address (before the @-sign). See the `allow_smtputf8`
97
-
option below.
97
+
checking if an address is in your database. When using this in a login form,
98
+
set `check_deliverability` to `False` to avoid unnecessary DNS queries.
98
99
99
100
Usage
100
101
-----
@@ -147,7 +148,7 @@ The `validate_email` function also accepts the following keyword arguments
147
148
require the
148
149
[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.
149
150
150
-
`check_deliverability=True`: Set to `False` to skip the domain name DNS record checks. You can also set `email_validator.CHECK_DELIVERABILITY` to `False` to turn it off for all calls by default.
151
+
`check_deliverability=True`: Set to `False` to skip the domain name DNS record checks. It is recommended to pass `False` when performing validation for login pages (but not account creation pages) since re-validation of the domain by querying DNS at every login is probably undesirable. You can also set `email_validator.CHECK_DELIVERABILITY` to `False` to turn it off for all calls by default.
151
152
152
153
`allow_empty_local=False`: Set to `True` to allow an empty local part (i.e.
153
154
`@example.com`), e.g. for validating Postfix aliases.
0 commit comments