Skip to content

Blog

Check if an email address exists without sending an email: an SMTP probe and its limits

Check if an email address exists without sending mail: a working SMTP RCPT TO probe in Python, how to read the reply codes, detect catch-all, and why it breaks.

Updated 2026-11-25

You can check whether an email address exists without sending anything by asking the recipient's mail server. Look up the domain's mail servers, open an SMTP connection, name the address with RCPT TO, read the reply, and disconnect before the DATA command that would carry a message. The server's answer tells you whether it accepts that mailbox. This post gives a working probe in Python, shows how to read the replies, and explains where it stops working, which happens more often than most tutorials admit.

How to verify an email address walks through the full chain of checks. This post is the code for the mailbox step.

The conversation, step by step

An SMTP session to check jane@example.org looks like this. Lines starting with a number come from the server.

220 mx.example.org ESMTP ready
EHLO mail.yourdomain.com
250-mx.example.org Hello
250 SIZE 52428800
MAIL FROM:<verify@yourdomain.com>
250 2.1.0 OK
RCPT TO:<jane@example.org>
250 2.1.5 OK
RCPT TO:<x7f3k9q2m1@example.org>
550 5.1.1 The email account that you tried to reach does not exist
QUIT
221 2.0.0 Bye

Two RCPT TO lines, no DATA. The first asks about the real address. The second asks about an address nobody would create: if the server accepted it too, it accepts everything, and the first answer meant nothing. That second check is how catch-all detection works. Catch-all email domains explains why domains are set up that way.

Find the mail servers

The mail servers of a domain are in its MX records. Lower preference values are tried first. RFC 5321 section 5.1 says that a domain with no MX record falls back to its address record, and RFC 7505 defines the null MX, a single record pointing to ., which declares that the domain accepts no mail.

bash
pip install dnspython
python
import dns.resolver


def mail_servers(domain):
    try:
        answer = dns.resolver.resolve(domain, "MX", lifetime=5)
    except dns.resolver.NXDOMAIN:
        return None
    except dns.resolver.NoAnswer:
        return [domain]
    records = sorted(answer, key=lambda record: record.preference)
    hosts = [str(record.exchange).rstrip(".") for record in records]
    return [host for host in hosts if host]

None means the domain does not exist. An empty list means a null MX: stop there, the address cannot receive mail. You can see the same records with the free MX lookup or dig +short MX gmail.com.

Probe the mailbox

smtplib from the standard library speaks SMTP. Used as a context manager, it sends QUIT when the block ends.

python
import secrets
import smtplib

HELO_NAME = "mail.yourdomain.com"
MAIL_FROM = "verify@yourdomain.com"


def probe(address, port=25, timeout=10):
    domain = address.rsplit("@", 1)[1].lower()
    hosts = mail_servers(domain)
    if hosts is None:
        return {"result": "no_such_domain"}
    if not hosts:
        return {"result": "accepts_no_mail"}
    failure = None
    for host in hosts[:2]:
        try:
            with smtplib.SMTP(host, port, local_hostname=HELO_NAME, timeout=timeout) as smtp:
                smtp.ehlo()
                code, message = smtp.mail(MAIL_FROM)
                if code != 250:
                    return {"result": "blocked", "host": host, "code": code}
                code, message = smtp.rcpt(address)
                result = classify(code, message)
                catch_all = None
                if result == "accepted":
                    invented = f"{secrets.token_hex(10)}@{domain}"
                    catch_all = classify(*smtp.rcpt(invented)) == "accepted"
                return {
                    "result": result,
                    "catch_all": catch_all,
                    "host": host,
                    "code": code,
                    "message": message.decode(errors="replace"),
                }
        except OSError as error:
            failure = type(error).__name__
    return {"result": "unreachable", "error": failure}

Set HELO_NAME to a hostname whose reverse DNS matches the IP you probe from, and MAIL_FROM to an address on a domain you control. Many servers check both and refuse strangers. smtplib errors, timeouts and refused connections are all subclasses of OSError, so one except covers them, and the loop tries the next mail server.

Read the reply codes

The three-digit code comes from RFC 5321. Most servers add an enhanced status code from RFC 3463, such as 5.1.1, which is more precise than the first three digits.

Reply Meaning Verdict
250, 251 Recipient accepted, or accepted and forwarded Accepted, unless the domain is catch-all
450, 451 Temporary failure, often greylisting Try again in a few minutes
452, or enhanced 4.2.2 Insufficient storage, or mailbox full Mailbox full, keep and recheck
550 with 5.1.1 Bad destination mailbox Does not exist
551, 553 User not local, or mailbox name not allowed Does not exist
5.2.1 Mailbox disabled Does not exist any more
550 with 5.7.x Refused by policy: your IP, your sender or your rate Blocked, says nothing about the mailbox
Other 5xx A refusal without a clear reason Unclear

Greylisting deserves a word: a server that greylists refuses the first attempt from an unknown sender with a temporary code and accepts a retry minutes later, because spam software often does not retry. RFC 5321 section 4.2.2 lists the base codes.

python
def classify(code, message):
    text = message.decode(errors="replace").lower()
    if code in (250, 251):
        return "accepted"
    if code in (452, 552) or "4.2.2" in text or "5.2.2" in text:
        return "mailbox_full"
    if 400 <= code < 500:
        return "try_later"
    if "5.1.1" in text or "5.1.10" in text or code in (551, 553):
        return "no_such_mailbox"
    if "5.2.1" in text:
        return "disabled"
    if "5.7." in text:
        return "blocked"
    return "refused_unclear"

We tested probe and classify against local SMTP servers built with aiosmtpd, each scripted to answer one way. A server that accepted only jane@ returned accepted with catch_all: False for her and no_such_mailbox for anyone else. A server that accepted every name returned accepted with catch_all: True. 451 4.7.1 Greylisted gave try_later, 452 4.2.2 gave mailbox_full, 550 5.7.1 client host blocked gave blocked, and a closed port gave unreachable with ConnectionRefusedError.

Where the probe breaks

The code is correct. The internet around it is what makes the answer unreliable.

  • Port 25 is blocked. Many home ISPs and most cloud providers block outbound port 25 by default. When we ran the probe from a residential connection, route1.mx.cloudflare.net on port 25 was unreachable. On a blocked network the probe returns unreachable for every address.
  • Catch-all domains. They accept every name, so 250 proves nothing. The invented address catches them, and the right verdict is "unknown", not "valid".
  • Providers that accept at RCPT and bounce later. RFC 5321 allows a server to accept a recipient and send a bounce afterwards. Some large providers do exactly that, so their 250 is the same for every address.
  • Greylisting and rate limits. A probe that hits one domain often gets temporary failures, then 5.7.x refusals, then a blocklisting of its IP.
  • Reputation. If you probe from the IP your application sends mail from, a blocklisting hurts your password resets and receipts. Never probe from your mail server or your web server.
  • No proof of a person. A mailbox that exists can be abandoned, shared or a spam trap. Only a confirmation email proves someone reads it.

VRFY is not a way around any of this. RFC 5321 section 7.3 notes that sites may disable VRFY and EXPN for security reasons, and most do.

Let an API run the probe

Running probes well means dedicated IPs with reverse DNS, an open port 25, retries for greylisting, per-domain pacing and handling for providers that answer the same for everyone. The Qelka email endpoint does the same conversation, EHLO, MAIL FROM, RCPT TO and the catch-all check, from servers we operate, and never sends DATA.

python
import os

import requests

response = requests.post(
    "https://api.qelka.com/v1/email",
    headers={"Authorization": f"Bearer {os.environ['QELKA_API_KEY']}"},
    json={"email": "jane@example.org"},
    timeout=15,
)
result = response.json()
print(result["status"], result["reason"], result["checks"]["smtp"], result["checks"]["catch_all"])

The probe outcomes map to documented fields:

Probe result API status API reason
accepted, not catch-all deliverable accepted_email
accepted, catch-all risky catch_all
no_such_mailbox undeliverable mailbox_not_found
disabled undeliverable mailbox_disabled
mailbox_full risky mailbox_full
try_later unknown greylisted
blocked unknown smtp_blocked
unreachable unknown smtp_timeout or smtp_unavailable
Same answer for every address unknown provider_unverifiable
accepts_no_mail undeliverable domain_null_mx
no_such_domain undeliverable domain_not_found

The response also carries syntax, disposable, role and free provider checks and a did_you_mean suggestion. A check costs 1 credit; checks that could not run on our side (smtp_unavailable, dns_error) are not billed. Results with greylisted, smtp_timeout or smtp_blocked are not cached, so asking again later runs a new probe. The email API reference lists every reason with what to do, and a sk_test_ key lets you test each branch without spending credits: see test mode.

What to do with each answer

  • Exists. Accept the address, and still send a confirmation email if it will be used for sign-in.
  • Does not exist. Reject it, and offer a correction when the domain looks like a typo.
  • Catch-all or unknown. Accept it at signup and let the confirmation email decide. For cold sending, weigh it against your bounce rate: email bounces explains hard and soft bounces and how to keep a list clean.
  • Mailbox full. Keep it and check again later.

For a no-code version, the verify an email without sending help page uses the free email verifier, and check if a domain is catch-all covers the second RCPT TO. The glossary defines RCPT TO, greylisting and catch-all domains. To run the same checks from a Python form, see validate an email address in Python.

Frequently asked questions

How can I check if an email address exists without sending an email?
Look up the domain's MX records, connect to the first mail server on port 25, send EHLO, MAIL FROM and RCPT TO with the address, read the reply code and quit before DATA. A 250 means the server accepts the mailbox, a 550 with the enhanced code 5.1.1 means it does not exist. Nothing is delivered. The answer is only as honest as the server, so catch-all domains and some large providers give no real signal.
Why does my SMTP check time out?
Most likely your network blocks outbound port 25. Many residential ISPs and most cloud providers block it by default to stop spam from infected machines and new servers. Your code connects to nothing and waits for the timeout. Test from a server where port 25 is open, or use a verification API that runs the probe from servers set up for it.
Can I use the VRFY command instead of RCPT TO?
Rarely. RFC 5321 describes VRFY, which asks the server to confirm a user, but section 7.3 notes that sites may disable it for security reasons, and most do. Servers that keep it often answer 252, which means the server cannot verify the user but will accept mail and try to deliver it. RCPT TO is what verifiers use, because a server has to answer it to receive mail at all.
Is checking an email with SMTP legal and safe?
The probe itself sends no message and reads only what any sending server would see. The risks are practical: a mail server that sees many probes from one address can rate-limit or blocklist it, and that can hurt the delivery of your real mail if it shares the address. Run probes from a dedicated IP with proper reverse DNS, slowly, and only for addresses you have a reason to check.

Put this check in your product

Get an API key in under a minute. 100 free credits every month, no card required.

  • 100 free credits a month
  • No card
  • Test keys spend nothing
  • Cancel any time