Subject: Weeks Best Travel Deals Delivered to Your Inbox

From: Summer Travel Packages <[email-masked]>
Date: Thu, 07 Aug 2014 12:38:41 -0700

Deal Alert: Up to 70% off Travel Available for Atompub-archive

View Deals By City:

Las Vegas
Boston
CanCun
Cabo San Lucas
Las Vegas
Manhattan
Oahu
Dubai
Rio de Janeiro
Calgary
Orlando
Chicago
Dallas
Miami
San Francisco
Phoenix
Paris
Rome
Athens
London
Seattle
San Diego
Washington, D.C.
Tampa
View More Cities...

Trouble Viewing the Image Below? Click Here

If you wish to no longer receive notifications from Dunhill Travel Deals, please click here. or write to Current Update Alerts

1644 Doral Dr_B r o o k i n g s , SD 57006

IMartin, I gave you a +1, only to later read that foobar@dk is a valid email. It wouldn't be pretty, but if you want to be both RFC compliant AND use common sense, you should detect cases such as this and ask the user to confirm that is is correct. philfreo Dec 16 '09 at 0:31

I was thinking more of the user entering 'name' in the password field or forgetting the .com/.dk part. But in general it isn't worth a regex to validate an address Martin Beckett Feb 24 '10 at 4:57
46
@olavk: if someone enters a typo (eg: me@hotmail), they're obviously not going to get your confirmation email, and then where are they? They're not on your site any more and they're wondering why they couldn't sign up. Actually no they're not - they've completely forgotten about you. However, if you could just do a basic sanity check with a regex while they're still with you, then they can catch that error straight away and you've got a happy user. nickf Jun 2 '10 at 13:53
1
One reason to validate email is because some SMTP servers are very picky about the address format and delimiting in email recipient lists. For example, the SMTP server I'm working with at work doesn't like it when you mix semicolons and commas as delimiters between addresses. Relevant to this question, it also doesn't like "None" and "[email-masked]" (notice the period before the @). If one of these anomalies is in the list, the whole recipient list will not get the email. SAGExSDX Jul 21 '10 at 15:09
3
@JacquesB: You make an excellent point. Just because it passes muster per the RFC doesnt mean it is really that users address. Otherwise all those [email-masked] addresses indicate a very netbusy commander-in-chief. :) tchrist Nov 7 '10 at 20:09
1
I would say [email-masked] at minimum. The reason being you don't want e-mails going to your localhost or local domain. I would also prevent "whitespaces" and anything between 0x00-0x1f from appearing in your e-mail as that can be an attack vector to your mail server. Also put a size limit as well to prevent 257+ character e-mail addresses. Archimedes Trajano Mar 15 '11 at 16:13
2
@nickf: Technically, a TLD isn't necessary, me@hotmail is valid. A better solution than regex would be to have a list of common email providers (hotmail.com, me.com, gmail.com, yahoo.com) and search for typos in the address. Charlie Melbye Apr 20 '12 at 19:07
1
Perhaps adding a js typeahead that suggests all the common email providers to help the user prevent typos (in addition to an email confirmation system of course). Gus Shortz Jun 6 '13 at 3:34

Most importantly, it doesn't fail for [email-masked] which is a lovely email address to send for those pesky places that want an email for no good reason at all. Edwin Buck Jun 20 '13 at 22:10

One reason to validate at the client side will be to save a trip to server. A more reasonable reason could be to provide a better user experience by warning at the earliest opportunity possible during a registration - would save time for both the user and probably also for a customer care person zencv Oct 28 '13 at 12:12
3
It doesn't have to be black or white. If the e-mail looks wrong, let the user know that. If the user still wants to proceed, let him. Don't force the user to c