Skip to content

Email address validation and verification

How to tell whether an email address is real: syntax and MX checks, SMTP probing, catch-all domains, double opt-in and re-typing.

3 min readUpdated

Validation checks that an address is well formed; verification checks that it can actually receive mail. A sign-up form needs both: validation catches typos at once, and verification keeps fake, disposable and mistyped addresses out of your list. This note covers how to probe a mail server by hand, how to detect a catch-all domain, and the methods to use in an application.

Check a mailbox by talking to the mail server

You can ask a domain’s mail server whether it would accept mail for an address, without sending a message. The steps below use plain SMTP commands.

Note: Many large providers (Gmail, Outlook) accept every recipient at this stage or rate-limit probes, and many networks block outgoing port 25. Treat the result as a hint, not proof, and do not probe at scale: mail servers treat it as address harvesting.

Find the mail server

Look up the domain’s MX records. The record with the lowest preference number is tried first.

Terminal window
dig +short MX example.com

nslookup -q=mx example.com gives the same answer where dig is not installed. A typical answer for a domain hosted by Google:

10 aspmx.l.google.com.
20 alt1.aspmx.l.google.com.
30 alt2.aspmx.l.google.com.

Open an SMTP session

Connect to the first mail server on port 25. nc works the same way as telnet here.

Terminal window
telnet aspmx.l.google.com 25

The server answers with a 220 greeting. Then introduce yourself, give a sender and ask about the recipient, one command at a time:

Terminal window
220 mx.google.com ESMTP - gsmtp
EHLO mail.example.org
250 mx.google.com at your service
MAIL FROM:<postmaster@example.org>
250 2.1.0 OK - gsmtp
RCPT TO:<someone@example.com>
250 2.1.5 OK - gsmtp
QUIT

A 250 after RCPT TO means the server would accept the message for that address. A 550 (for example 550 5.1.1 The email account that you tried to reach does not exist) means the mailbox does not exist. A 450 or 451 is a temporary refusal, often greylisting: try again later. End with QUIT so that nothing is sent.

Detect a catch-all domain

A catch-all domain accepts mail for any address, so the check above always says yes. To find out, repeat RCPT TO with an address that cannot exist, such as zx81-no-such-user-4711@example.com. If the server answers 250 for it too, the domain is catch-all and SMTP probing cannot tell you whether the real address exists.

Methods to use in an application

Double opt-in

When a user registers, send a unique link to the address and activate the account only after the link is opened. This proves that the address exists and that the person registering controls it. It also stops sign-ups with someone else’s address and keeps bots out. Double opt-in is the only method in this note that verifies ownership; everything else only checks deliverability.

Re-type the address

Asking the user to type the address twice catches typos before submission. It does nothing against a user who enters an address they do not own, so combine it with double opt-in.

Automated verification checks

Verification services and libraries usually combine these checks:

  • Syntax: the address follows RFC 5322 (in practice, a pragmatic subset of it).
  • Domain and MX records: the domain exists in DNS and has MX records (or an A record as fallback).
  • Mailbox: an SMTP probe as described above, with its limits.
  • Catch-all: whether the domain accepts any recipient.
  • Disposable addresses: the domain belongs to a throwaway-mail provider.
  • Misspelled domains: gmial.com instead of gmail.com. Suggest the correction instead of rejecting the address.
  • Greylisting: a temporary refusal from a server that rejects unknown senders at first; retry before deciding.
  • Spam traps: addresses that exist only to catch senders with poorly kept lists. Sending to them damages your sender reputation.
  • List hygiene: remove addresses that bounce, unsubscribed or complained, and addresses that never engage.

References

Related notes

3 min read

E-commerce KPIs

Formulas for the e-commerce KPIs worth tracking, from return on investment and conversion rate to customer lifetime value and NPS.

  • Business

Type to search the whole site.