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
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,6 +150,7 @@ The `validate_email` function also accepts the following keyword arguments
150
150
`allow_empty_local=False`: Set to `True` to allow an empty local part (i.e.
151
151
`@example.com`), e.g. for validating Postfix aliases.
152
152
153
+
`strict=False`: Set to `True` to perform additional syntax checks (currently only a local part length check). This should be used by mail service providers at address creation to ensure email addresses meet broad compatibility requirements.
# explains the maximum length of an email address is 254 octets.
41
+
# explains the maximum length of an email address is 254 octets based on RFC 5321 4.5.3.1.3. A
42
+
# maximum local part length is also given at RFC 5321 4.5.3.1.1.
43
+
#
44
+
# But RFC 5321 4.5.3.1 says that these (and other) limits are in a sense suggestions, and longer
45
+
# local parts have been seen in the wild. Consequntely, the local part length is only checked
46
+
# in "strict" mode. Although the email address maximum length is also somewhat of a suggestion,
47
+
# I don't like the idea of having no length checks performed, so I'm leaving that to always be
48
+
# checked.
41
49
EMAIL_MAX_LENGTH=254
42
50
LOCAL_PART_MAX_LENGTH=64
51
+
52
+
# Although RFC 5321 4.5.3.1.2 gives a (suggested, see above) limit of 255 octets, RFC 1035 2.3.4 also
53
+
# imposes a length limit (255 octets). But per https://stackoverflow.com/questions/32290167/what-is-the-maximum-length-of-a-dns-name,
54
+
# two of those octets are taken up by the optional final dot and null root label.
43
55
DNS_LABEL_LENGTH_LIMIT=63# in "octets", RFC 1035 2.3.1
44
-
DOMAIN_MAX_LENGTH=253# in "octets" as transmitted, RFC 1035 2.3.4 and RFC 5321 4.5.3.1.2, and see https://stackoverflow.com/questions/32290167/what-is-the-maximum-length-of-a-dns-name
('test@\n', 'The part after the @-sign contains invalid characters: U+000A.'),
416
416
('bad"quotes"@example.com', 'The email address contains invalid characters before the @-sign: \'"\'.'),
417
417
('obsolete."quoted"[email protected]', 'The email address contains invalid characters before the @-sign: \'"\'.'),
418
-
('11111111112222222222333333333344444444445555555555666666666677777@example.com', 'The email address is too long before the @-sign (1 character too many).'),
419
-
('111111111122222222223333333333444444444455555555556666666666777777@example.com', 'The email address is too long before the @-sign (2 characters too many).'),
420
-
('\uFB2C111111122222222223333333333444444444455555555556666666666777777@example.com', 'After Unicode normalization: The email address is too long before the @-sign (2 characters too many).'),
421
418
('me@1111111111222222222233333333334444444444555555555.6666666666777777777788888888889999999999000000000.1111111111222222222233333333334444444444555555555.6666666666777777777788888888889999999999000000000.11111111112222222222333333333344444444445555555555.com', 'The email address is too long after the @-sign (1 character too many).'),
422
419
('me@中1111111111222222222233333333334444444444555555555.6666666666777777777788888888889999999999000000000.1111111111222222222233333333334444444444555555555.6666666666777777777788888888889999999999000000000.1111111111222222222233333333334444444444.com', 'The email address is too long after the @-sign (1 byte too many after IDNA encoding).'),
423
420
('me@\uFB2C1111111111222222222233333333334444444444555555555.6666666666777777777788888888889999999999000000000.1111111111222222222233333333334444444444555555555.6666666666777777777788888888889999999999000000000.1111111111222222222233333333334444444444.com', 'The email address is too long after the @-sign (5 bytes too many after IDNA encoding).'),
('11111111112222222222333333333344444444445555555555666666666677777@example.com', 'The email address is too long before the @-sign (1 character too many).'),
471
+
('111111111122222222223333333333444444444455555555556666666666777777@example.com', 'The email address is too long before the @-sign (2 characters too many).'),
472
+
('\uFB2C111111122222222223333333333444444444455555555556666666666777777@example.com', 'After Unicode normalization: The email address is too long before the @-sign (2 characters too many).'),
0 commit comments