New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email addresses #45

Open
govuk-design-system opened this Issue Jan 12, 2018 · 8 comments

Comments

7 participants
@govuk-design-system
Collaborator

govuk-design-system commented Jan 12, 2018

Use this issue to discuss this pattern in the GOV.UK Design System.

@govuk-design-system govuk-design-system created this issue from a note in GOV.UK Design System Community Backlog (In progress) Jan 12, 2018

@govuk-design-system govuk-design-system moved this from In progress to Published in GOV.UK Design System Community Backlog Jan 12, 2018

@timpaul

This comment has been minimized.

Contributor

timpaul commented Mar 13, 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

@timpaul timpaul added the pattern label May 21, 2018

@benilovj

This comment was marked as resolved.

benilovj commented Jun 21, 2018

The code example for the input tag uses type="text":

<input class="govuk-input" id="email" name="email" type="text" aria-describedby="email-hint">

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?

@36degrees

This comment was marked as resolved.

36degrees commented Jun 21, 2018

Nope – great spot!

I've raised a PR to fix it. Thanks.

@NickGrantONS

This comment has been minimized.

NickGrantONS commented Aug 1, 2018

@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 !#$%&*/=?^{|}~ (and backticks too!) should be permissible.

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.

Cheers!

@sussexrick

This comment was marked as resolved.

sussexrick commented Aug 1, 2018

The recommendation of 30 characters as a field size limit seems a bit short. My email address is 32 characters and it's nothing unusual, just firstname.lastname@where-i-work.gov.uk

@leohemsted

This comment has been minimized.

leohemsted commented Aug 1, 2018

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 notification_utils/__init__.py)

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 test key - test keys don't actually send anything, and we'll tell you immediately if it's invalid.

@36degrees

This comment was marked as resolved.

36degrees commented Aug 1, 2018

The recommendation of 30 characters as a field size limit seems a bit short. My email address is 32 characters and it's nothing unusual, just firstname.lastname@where-i-work.gov.uk

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

@timpaul

This comment has been minimized.

Contributor

timpaul commented Aug 22, 2018

Here are 2 things that the GOV.UK Pay team have done to help users enter correct emails:

  1. Play back the email address as users enter it, so they are more likely to spot an error

image

  1. Spot common typos and warn the user when they submit the form

image

Doing this has reduced instances of users entering invalid emails by 33%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment