ensure emails are formatted before sending

we allow some invalid to addresses - for example, phone numbers with
spaces or brackets - in the database. This is so that users can match
up their data in a format that they expect (since they passed it in).
When we send SMS, we strip this formatting just before sending - but we
weren't with email. This commit changes that and adds some tests.

It also adds formatting for reply_to addresses. We should never expect
invalid reply_to email addresses in our data, but just in case, lets
validate them here.

Also, bump requirements.txt to capture some more email validation
This commit is contained in:
Leo Hemsted
2017-10-16 17:29:45 +01:00
parent 45ecab00e3
commit 5ad6bc7621
4 changed files with 67 additions and 5 deletions
+1 -1
View File
@@ -26,6 +26,6 @@ notifications-python-client==4.4.0
awscli>=1.11,<1.12
awscli-cwlogs>=1.4,<1.5
git+https://github.com/alphagov/notifications-utils.git@21.3.1#egg=notifications-utils==21.3.1
git+https://github.com/alphagov/notifications-utils.git@21.4.1#egg=notifications-utils==21.4.1
git+https://github.com/alphagov/boto.git@2.43.0-patch3#egg=boto==2.43.0-patch3