Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Email addresses #45
created this issue from a note
in GOV.UK Design System Community Backlog
Jan 12, 2018
Here are the tests for valid and invalid email addresses, used by the GOV.UK Notify team: https://github.com/alphagov/notifications-utils/blob/e428bdd0ca82f7b97833e707eea95dae849713fb/tests/test_recipient_validation.py#L103-L149
The code example for the
but the 'help users to enter a valid email address' section mentions:
"using the type=“email” attribute so that devices display the correct keyboard"
Is the inconsistency intentional?
@timpaul we're using gov.uk Notify over at the ONS and we've been looking into the valid/invalid emails.
According to Wikipedia, the local part of the email supports a lot more weird and wonderful characters and things than Notify does: https://en.wikipedia.org/wiki/Email_address#Local-part
Specifically, the special characters
Also, the example with the 2 consecutive dots which is "technically valid" according to the source link you pasted is actually invalid according to the Wiki article.
Confused about what we should implement in our UI. Any pointers gratefully received.
Hi @NickGrantONS, I'm a developer over on Gov.uk Notify. While being careful not to derail this conversation too much, a couple of points about the validation. We've tweaked our validation quite a bit since Tim commented with that link - check out the current version at https://github.com/alphagov/notifications-utils/blob/master/tests/test_recipient_validation.py#L104-L151 (the regexes used can be found at
Those special characters you listed are now valid, and the consecutive dots example is now correctly invalid. That said, we still don't allow some very unusual email addresses that are technically valid - notably emails with the local part wrapped in double quotes. We've never seen any of these emails in the wild, and it would greatly increase the complexity of our validation logic.
Our goal is simply "Have notify's validation match our own email provider's validation" (we currently use Amazon SES) - so that we can reject any invalid email addresses as soon as we receive them.
If you want to be sure we'll accept the email address, you could send a message to the supplied email address via notify using a
Good spot, thanks. I think this guidance is unclear as a couple of concepts have ended up muddled together since this was rewritten from the service manual.
I’ve raised a PR which should hopefully provide some clarification: alphagov/govuk-design-system#464
Here are 2 things that the GOV.UK Pay team have done to help users enter correct emails:
Doing this has reduced instances of users entering invalid emails by 33%