SpyreStudios

Web Design and Development Magazine

  • Design
  • Showcase
  • Inspirational
  • Tutorials
  • CSS
  • Resources
  • Tools
  • UX
  • More
    • Mobile
    • Usability
    • HTML5
    • Business
    • Freebies
    • Giveaway
    • About SpyreStudios
    • Advertise On SpyreStudios
    • Get In Touch With Us

The Best Way To Validate Email Addresses

August 2, 2017 by Alex Fox

validate email addresses hero

It seems like it should be easy to validate email addresses. After all, it’s pretty easy to recognize a valid email address on sight. Shouldn’t that make it easy to validate one with a computer? If only we were so lucky.

That Dragon, Email Validation

Designed by Freepik

For a long time, web designers worked hard to create a perfect email address validation system. Having a broken email address on your mailing list is frustrating for you and frustrating for the user. If you pay on a per-subscriber basis, for example, broken email addresses represent a total waste of money. And if the user was excited to receive your mailing list and then never does, they’ll feel let down. But broken email addresses aren’t the worst of it: if you just accept unprocessed user input on a web form, you leave yourself open to a vast array of security holes. So web designers have often attempted, with various levels of commitment, to pre-determine whether email addresses are correct.

Let’s imagine that, as naive, fresh-faced web developers, we decide to write a regular expression or script that verifies an email address before a sign up form is submitted. What kind of qualifications would we use to judge our prospective email address? Well, we would definitely look for the @ symbol. We know that’s required for every email address. And we should probably check to see if the email address ends in a top level domain. So we create a regular expression that matches against @ and a pile of TLDs – .com, .net., .org., .edu and .gov, for example. You’ve probably realized the major problem with this process, which is that it doesn’t include any country TLDs, or any newer TLDs like .today or .limo. So maybe we expand our list of TLDs to include all these new ones, as well as country-level domains.

We still have a problem though: new top-level domains get added pretty regularly. If we hard-code the list of “valid” TLDs in our regular expression, we’ll need to change the script on every site we’ve built every time a new TLD is added. Even if we use one centralized script, it’s a maintenance headache we’d rather avoid.

Even if we attempt to validate against the specification that describes valid email address, we still probably won’t get it right. People have tried, and we end up with a regular expression so complex that its virtually unreadable. And when we throw in non-Latin characters and ever-evolving standards, we can end up with a real nightmare for maintenance.

But even if we could write a perfect validation script, there’s a bigger problem. Simply validating email address this way doesn’t confirm intent. Regular expressions can’t prevent accidental sign ups, nor can they prevent pranks like users signing up a friend for newsletters or something equally mischievous. But more important, this validating doesn’t confirm that the email address is actually active and in use. It only confirms that it meets some kind of formatting standard.

There has to be a better way to validate email addresses!

The Best Way To Validate Email Addresses

best way to validate email addresses

Designed by Freepik

Hands down, the best way to validate an email address is to send an email to that address. This is the dominant method of validating email addresses in the industry, and we know that it works every time. Mass-mailing companies like MailChimp and Constant Contact use this technique to validate mailing list subscriptions, as do other companies that handle email in industrial quantities. Let’s check out the process using the example of a mailing list signup:

1. User inputs email address: The user types their email address in a box on your website and clicks “Sign Up!” to sign up for your mailing list.

2. User sees a thank-you screen: This screen confirms that the user has just signed up for your mailing list. Importantly, this screen also tells the user that, before their subscription is confirmed, they must click on a confirmation email which they’ll receive shortly.

3. Confirmation email is sent: Your mailing list system sends out an email to this provided email address with a link. That link, when clicked, automatically marks the customer’s email as “valid” in your mailing list database.

4. User receives confirmation email: The confirmation email shows up in the user inbox. They open the email and click on a large “Confirm Subscription!” button to finalize their subscription.

5. Final confirmation message: After clicking on this button or link to confirm their subscription, the user sees a success screen, thanking them for signing up. You might also show them a sample newsletter, or otherwise contextualize what they’ve just accomplished.

We should also have an “abort” button someone in this process. In a well-designed scheme, the user will have a clear off-ramp to cancel the subscription process. If they realize half way through the subscription process that they would prefer not to receive your newsletter, they should know what to do. For example, the confirmation email should include some kind of language that covers this situation. You might say, “If you didn’t mean to sign up for this newsletter, simply ignore this email and you will be removed from our mailing list.” And most users are bright enough to know that, should they stop half way through the subscription process, the subscription won’t be completed.

Conclusion: Best of Both Worlds

The best strategy for validating emails combines both techniques. We use a simple regular expression on our form to make sure the most fundamental parts of an email address, like the @ symbol, are present. If that bar is passed, then we confirm that the email address is functional by sending a confirmation email to that address. The best news is that you don’t even need to write this yourself. If you embed the newsletter signup form from MailChimp (or another newsletter company), you can get all this taken care of without any personal input.

Featured image designed by Freepik

You might also like:

Responsive Email Templates: Building a Newsletter from Scratch
The Dos and Don’ts of Newsletter Design

 

Filed Under: Article Tagged With: tips, web design

Recent Posts

  • How to use a PDF file combiner to support a Web planner optimally
  • What Factors Determine the Best Digital Marketing Agency?
  • 31 Fresh Design Elements for Spring and Easter
  • 10 Templates for Music Concert Flyers
  • How to Build a Web Scraper Using Node.js

Archives

  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • January 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • May 2008
  • April 2008

Categories

  • Accessibility
  • Android
  • Apps
  • Art
  • Article
  • Blogging
  • Books
  • Bootstrap
  • Business
  • CSS
  • Design
  • Development
  • Ecommerce
  • Fireworks
  • Flash
  • Freebies
  • Freelance
  • General
  • Giveaway
  • Graphic Design
  • HTML5
  • Icons
  • Illustrator
  • InDesign
  • Infographics
  • Inspirational
  • Interview
  • Jobs
  • jQuery
  • Learning
  • Logos
  • Matrix
  • Minimalism
  • Mobile
  • Motion Graphics
  • Music
  • News
  • Photoshop
  • PHP
  • Promoted
  • Rails
  • Resources
  • Showcase
  • Tools
  • Tutorial
  • Twitter
  • Typography
  • Uncategorized
  • Usability
  • UX
  • Wallpapers
  • Wireframing
  • WordPress
  • Work

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

SpyreStudios © 2022