How To Check If An Email Address Is In A Valid Format

Last Updated Mar 20, 2022
Emma Jagger

Engineer, maker, Google alumna, CMU grad

Table of Contents:

Checking the validity of your client’s email address is very important for your business. It helps you to identify incorrect IDs and spammers. So, you can keep your mailing list clean with the correct and genuine email addresses. There are different ways to check the validity. The most common way is using an API, like Abstract’s Email Verification and Validation API. It can help you to determine the validity of the email address quickly. In this post, you will find all the details.

Don't reinvent the wheel.
Abstract's APIs are production-ready now.

Abstract's suite of API's are built to save you time. You don't need to be an expert in email validation, IP geolocation, etc. Just focus on writing code that's actually valuable for your app or business, and we'll handle the rest.

Get started for free

Why Do You Need To Validate Email Addresses?

Real customers start with real email IDs. They enable you to reach genuine clients effectively. You don’t want to send emails to fake email IDs. It will lead to high bounce rates. As a result, your sender reputation will be damaged. Ultimately, your emails will end up in the junk folder of the recipient. They will never be opened. So, your emails will have a very low open rate. You never want it to happen. Also, you don’t want to see spammers using fake IDs to sign up on your site. It will make your marketing campaign fail miserably.

You can solve all these issues by validating email addresses.It will help you to eliminate the fake email IDs from your mailing list. So, you don’t have to worry about high bounce rates and sender reputation damage. Also, it will prevent spammers from getting into your mailing list.  

Checklist for a Valid Email Address

Syntax Email Validation

A valid email address has four parts. They are:

  • Recipient name: It represents an email mailbox that belongs to a person. It can also belong to an organization or a department within a company. The recipient name can be up to 64 characters long. It may consist of uppercase and lowercase letters in English (A-Z, a-z). Also, it can have digits from 0 to 9, and special characters, such as: ! # $ % & ' * + - / = ? ^ _ ` { | .
  • @ symbol: It is used to separate the recipient name from the domain name.
  • Domain name: It defines a space on the internet owned by a specific mailbox provider, like Gmail and Yahoo Mail. It can be up to 253 characters long. It may consist of uppercase and lowercase letters in English (A-Z, a-z), digits from 0 to 9, a hyphen (-), and a period (.).
  • Top-level domain: It is the highest level of the domain name system for the internet. It is placed after the domain name in an email address. Common top-level domains are: .com, .net, and .org.

Now, let’s take a look at the syntax practically by analyzing different parts of this email address: johndoe52@gmail.com

  • Johndoe52: It’s the name of the recipient.
  • @: This is the symbol that you find in every email ID. It helps you to separate the recipient name from the domain name.
  • gmail: Is the domain name.
  • .com: This is the top-level domain.

Acceptable Email Prefix Formats

A valid email address consists of an email prefix and an email domain. The prefix appears to the left of the @ symbol. On the other hand, the domain appears to the right. Both of them need to have acceptable formats.

Invalid email prefixes:
  • abc-@mail.com
  • abc..def@mail.com
  • .abc@mail.com
  • abc#def@mail.com
Valid email prefixes:
  • abc-d@mail.com
  • abc.def@mail.com
  • abc@mail.com
  • abc_def@mail.com

Acceptable Email Domain Formats

The email domain may have letters, numbers, and dashes. The last portion must have at least two characters, like .com, .org, .cc, etc.

Invalid email domains:
  • abc.def@mail.c
  • abc.def@mail#archive.com
  • abc.def@mail
  • abc.def@mail..com
Valid email domains:
  • abc.def@mail.cc
  • abc.def@mail-archive.com
  • abc.def@mail.org
  • abc.def@mail.com

Regular Expression Example To Validate Email Address String

The valid email address comes with a @ symbol. There must be some preceding and proceeding strings. The proceeding strings need to have a dot (.), followed by an additional 2-3 characters. Overall, a valid email address string format looks like this:


(randomString1)@(randomString2).(2-3 characters)

With that in mind, you can create a Regular Expression to validate an email address string effectively. It looks like this:


[a-z0-9]+@[a-z]+\.[a-z]{2,3}

How about using this Regular Expression in JavaScript to perform the validation? Let’s try with this code:


let regex = new RegExp('[a-z0-9]+@[a-z]+\.[a-z]{2,3}');

let testEmails = ["notanemail.com", "workingexample@email.com", "another_working@somethingelse.org", "notworking@1.com"];

testEmails.forEach((address) => {
  console.log(regex.test(address))
});

You will get this output:


false
true
true
false

As you can see, the first and fourth email IDs are invalid. However, the second and third addresses are valid.

Will it always work? No, some malformed email IDs will still manage to pass through the specified condition. Also, you cannot perform spam detection with Regular Expression. You need to look for an alternative solution to validate email addresses with enhanced efficiency and advanced technologies.

Check for Disposable Emails

Disposable email is a service that allows users to receive emails at a temporary address. The address automatically expires after a certain time. The service is widely abused by spammers around the world. They use it to make fake sign-ups at your website and perform fraudulent activities. So, you need to identify and eliminate disposable emails effectively.

How can you get rid of disposable emails? You can think about disallowing signups from established disposable email address domains. However, it will not be an easy task. There are dozens of existing domains, with more being added regularly. It will be very difficult for you to track all of them. You can also think about performing periodic audits to check the delivery status of your emails. However, you will be exhausted doing it regularly. You don’t want to check the delivery status of hundreds of emails manually.

Is there any easy way to check for disposable emails easily? By utilizing an email address validation API, you can eliminate the disposable emails from your database effortlessly.  You just need to make an API request by passing the access key and the email IDs. The API will detect the disposable email addresses instantly.

You can use Abstract’s Email Address Validation & Verification API to identify disposable emails in your mail listing easily. Try it now for free.

DNS Lookup

DNS Lookup is the process of finding detailed information about a specified domain name. It enables you to identify important data, like domain availability, IP addresses, expiration date, registration/creation date, owner of the domain, etc.

To perform the DNS lookup, simply open your console app and run this command:


nslookup johndoe23452@mailinator.com

You will get this result:


*** Unknown can't find johndoe23452@mailinator.com: Non-existent domain

Methods to Ensure You Receive a Valid Email 100% of the Time

An API

Another great way of validating emails is using an API. It can make the entire process very simple. You can use it to verify the IDs in just a few seconds.

You can try using Abstract’s Email Validation and Verification API. It is lightweight and super-fast. It allows you to validate email addresses easily and quickly. 

Abstract’s Email Validation and Verification API enables you to validate email strings effortlessly. Try it now for free.

Let’s verify this email address with Abstract’s Email Validation and Verification API: johnsmith@gmail.com

Let’s make an API request:

If the request is successful, you will get this JSON response:


{
  "email": "johnsmith@gmail.com",
  "autocorrect": "",
  "is_valid_format": true,
  "is_free_email": true,
  "is_disposable_email": false,
  "is_role_email": false,
  "is_catchall_email": false,
  "is_mx_found": true,
  "is_smtp_valid": true,
  "quality_score": 0.99,
}

Notice that "is_valid_format" is set to true. That means the given email address is valid. Also, you get a variety of useful data, like quality score, email role, SMTP validation, etc. By using this information, you can determine the validity of the email IDs effectively and effortlessly.

Read: Top 5 Free Email Validation APIs

Sending Your Users an Email

How about sending an email to the users and requesting a return receipt? It will help you to find whether the email has been delivered or not. However, there are some limitations. Not all email address providers support the return receipt feature. Also, a recipient can opt-out of sending a return receipt. So, there's no guarantee of getting it. 

If you are using Microsoft Outlook, you can request separate return receipts for the delivery and opening of your email. If you are using Gmail, you can request the return receipt for only the opening of your email. There’s no additional receipt for delivery. Also, you need to have a Google Workspace administrator account. Free Gmail accounts do not support the feature. You can find the steps of getting return receipts in both Microsoft Outlook and Gmail right here.

Recommended Content

Email validation FAQs

How Do You Set Up Email Validation?

You can easily set up email validation by using APIs, like Abstract’s Email Validation and Verification API. It enables you to find genuine email IDs effortlessly. All you have to do is make an API request with the access key and email addresses. You will get the IDs validated instantly.

What Is An Email Validation?

Email validation is the process of verifying an email address to determine its deliverability and validity. It involves utilizing various methods, like syntax check, typo check, SMTP verification, etc. It helps you to find and eliminate fake email IDs effortlessly. So, you can keep your mailing list clean with genuine email addresses.

What Is An Unverified Sender?

An unverified sender is a feature of Office 365. It enables you to identify potential spam or phishing emails in your inbox. When the feature detects a suspicious email, it displays a question mark in place of the sender’s avatar or contact initials. So, you can detect potential phishing attacks quickly.

Validate email addresses in seconds using Abstract's email verification API.

Get started for free
Validate email addresses in seconds using Abstract's email verification API.
Get started