Skip to content

Commit

Permalink
Validate email addresses with special characters (#60)
Browse files Browse the repository at this point in the history
* Validate email addresses with special characters

* Version bump
  • Loading branch information
AntoineAugusti committed Sep 21, 2020
1 parent b72aa52 commit 39eb59a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion notifications_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Note: Normal apostrophe eg `Firstname-o'surname@domain.com` is allowed.
hostname_part = re.compile(r'^(xn-|[a-z0-9]+)(-[a-z0-9]+)*$', re.IGNORECASE)
tld_part = re.compile(r'^([a-z]{2,63}|xn--([a-z0-9]+-)*[a-z0-9]+)$', re.IGNORECASE)
VALID_LOCAL_CHARS = r"a-zA-Z0-9.!#$%&'*+/=?^_`{|}~\-"
VALID_LOCAL_CHARS = r"a-zA-ZÀ-ÿ0-9.!#$%&'*+/=?^_`{|}~\-"
EMAIL_REGEX_PATTERN = r'^[{}]+@([^.@][^@\s]+)$'.format(VALID_LOCAL_CHARS)
email_with_smart_quotes_regex = re.compile(
# matches wider than an email - everything between an at sign and the nearest whitespace
Expand Down
2 changes: 1 addition & 1 deletion notifications_utils/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '43.0.1'
__version__ = '43.0.2'
# GDS version '34.0.1'
4 changes: 4 additions & 0 deletions tests/test_recipient_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
'info@german-financial-services.vermögensberatung',
'info@german-financial-services.reallylongarbitrarytldthatiswaytoohugejustincase',
'japanese-info@例え.テスト',
"fançoisthe'éüî@mailinator.com",
"Jean-o'briån@mailinator.com",
"Tom!the#taglover?@mailinator.com",
"2+2={5*4/5}@mailinator.com",
)
invalid_email_addresses = (
'email@123.123.123.123',
Expand Down

0 comments on commit 39eb59a

Please sign in to comment.