What is the best way to verify an email?

Last Updated Feb 01, 2021
Emma Jagger

Engineer, maker, Google alumna, CMU grad

Whether it comes from a user, from a remote API, or even from your database, it is necessary to validate the data's consistency for any data type.

How to verify an email address?

Let's take the example of an email address that would be provided by a person who wants to subscribe to your newsletter. Logically your script will check the following elements:

  • the value provided by the user is not empty,
  • its length does not exceed that authorized by the database, at the risk of being truncated,
  • it contains the symbol @.

These rules are sufficient for a first validation step, and are typically what an email validation regular expression (or regex) will do. Then, and since you want to make sure that the email address exists and belongs to the registering person, your script will send a message containing a confirmation link to the provided address. It is only when the person clicks on this link, which includes a secret identification key, that their subscription to your newsletter will be valid.

This system works very well, so much so that it is used by many websites, whether for newsletter subscription or account creation.

Is it necessary to check the email addresses once or regularly?

But what about historical data? After some time, users may delete their mailboxes, email services may get closed, and the emails in your database could become invalid.

You may consider that having invalid email addresses in your database is not an issue, but you will observe that the rate of invalid emails will increase over time. The direct consequence is that all your informational or promotional mailings will have a higher proportion of bouncebacks, and that's something you should be concerned about. Your emails may also have a very low open rate because they're being sent to free or disposable emails addresses.

What is email bounceback, and what does it mean for your business?

A bounceback email is simply an email message that cannot be delivered to the recipient. The most common reason for this kind of error is that the recipient's mailbox does not exist.

But bouncebacks have a significant impact on your business: more emails will be sent back to your servers, more the reputation of your domain names and IP addresses used by your servers will suffer. There are regulations on the Internet that combat email spam, and the bounceback rate is one of their metrics.

If you do nothing about bounceback, your mail servers could be flagged as spam servers, and they would be blacklisted from a vast number of mail servers, which would ruin your emails' deliverability.

How do you keep a database of email addresses always up to date?

You should regularly check all the email addresses in your database. It is however unthinkable to send a verification link once a month to your users, as you did at the registration time. It is necessary to do this verification by other means.

The smart solution is to regularly pass your email addresses through an email validation API to ensure that the SMTP configuration corresponding to the email address is still correct. Abstract provides a free API that can do just that and is very easy to use, although there are many email validation and verification API's. The Abstract API can be used by any language capable of making a GET request on the Internet. Here is an example that you can use directly in your browser:


https://emailvalidation.abstractapi.com/v1/?api_key=YOU_API_KEY&email=johnsmith@gmail.com

And here is the response:


{
  "email": "johnsmith@gmail.com",
  "autocorrect": "",
  "deliverability": "DELIVERABLE",
  "quality_score": 0.90,
  "is_valid_format": {
        "value": true,
        "text": "TRUE"
        },
  "is_free_email": {
        "value": true,
        "text": "TRUE"
        },
  "is_disposable_email": {
        "value": false,
        "text": "FALSE"
        },
  "is_role_email": {
        "value": false,
        "text": "FALSE"
        },
  "is_catchall_email": {
        "value": false,
        "text": "FALSE"
        },
  "is_mx_found": {
        "value": true,
        "text": "TRUE"
        },
  "is_smtp_valid": {
        "value": true,
        "text": "TRUE"
        },
  "quality_score": 0.90,
}


Related articles

No items found.
Abstract's Email Verification API makes it easy verify emails quickly.
Get started