A developer adds an email check to a signup form. When someone signs up, the code connects to the mail server for their address, asks whether that inbox exists, and blocks the signup if the answer is no. Tested against a handful of personal addresses, it works perfectly. In production, something odd happens: a noticeable share of business signups come back with 450 4.7.1 Please try again later. The code treats that as a failure, and real customers are turned away at the door.
The check didn't have a bug in the usual sense. It ran into greylisting, and it read a temporary "not right now" as a permanent "no."
There are two ways to deal with it: build proper handling for temporary failures into your own check, or hand the job to an email verifier that manages greylisting for you. This article covers what greylisting is, how an SMTP email check works, why greylisting breaks it, why retrying from your own server rarely fixes it, how your code should handle a temporary failure, and when it makes sense to hand the check off.
What is greylisting?
Greylisting is an anti-spam technique. When a mail server receives a message from a sender it hasn't seen before, it temporarily refuses it and asks the sender to try again later.
The server decides who is "new" using three pieces of information, often called the triplet: the IP address of the server sending the mail, the sender's email address, and the recipient's email address. The first time a particular combination shows up, it gets a temporary rejection. If the same combination comes back after a delay, it is let through and remembered.
The trick works because of how the two kinds of sender behave. Legitimate mail servers are built to retry automatically after a temporary failure, usually after a few minutes, so real mail arrives slightly late but arrives. Many spam tools fire off messages once and never retry, so their mail never gets through.
The temporary rejection comes back as a reply code in the 400s, meaning "temporary failure, try again later." That is different from a code in the 500s, which means "permanent failure, don't try again."
The catch for developers is that a verification script looks a lot like the senders greylisting is designed to filter out.
How does an SMTP email check work?
SMTP is the protocol mail servers use to hand email to each other. A verification check uses the first half of that conversation and stops before any email is actually sent.
- Find the mail server. Look up the domain's MX record, the DNS entry that says which server receives email for that domain. (The domain is the part of the address after the @.)
- Connect and introduce yourself. Open a connection to that server and greet it with EHLO, giving your own server's name.
- Give a sender. Send MAIL FROM with a sender address.
- Name the recipient. Send RCPT TO with the address you want to check.
- Read the reply and leave. Note the reply code, then disconnect with QUIT without sending a message.
The reply to RCPT TO falls into one of three families:
- 2xx (for example 250): the server accepts mail for that address.
- 5xx (for example 550 5.1.1, user unknown): the server permanently rejects it.
- 4xx (for example 450 4.7.1): the server is saying "not right now, try again later."
One caveat worth knowing, though it's a topic of its own: some domains are catch-all, meaning they accept mail for any address. On those, a 2xx tells you nothing about whether the person exists.
The family that causes the most confusion, though, is the third one.
Why does greylisting break a verification check?
A verification check makes one attempt, reads the reply and disconnects. It never comes back later the way a real mail server would, so from the greylisting server's point of view it is exactly the kind of one-shot sender the technique exists to filter out. The greylist never clears.
More importantly, the 4xx reply isn't an answer about the mailbox at all. It is the server saying it hasn't decided to talk to you yet. The person behind the address may well exist; the check simply never got far enough to find out.
That leaves code with two tempting mistakes:
- Treating 4xx as invalid. Real people get rejected, which is exactly what happened to the signup form at the start of this article.
- Treating 4xx as valid. Dead addresses get through, and the bounces show up later, when real email is sent to them.
The obvious next idea is to wait and try again. That works less well than it sounds.
Why doesn't retrying from your own server fix it?
Waiting a few minutes and repeating the check from the same server will clear the greylist on some mail servers. But doing it from your own infrastructure brings a new set of problems.
- Port 25 is often blocked. Mail servers talk to each other on port 25, and many cloud providers block or throttle outbound connections on that port by default to limit spam from their networks. A check running on a typical cloud server may not be able to connect at all.
- You start to look like a harvester. Repeated connections that ask about addresses but never deliver mail are exactly what address harvesting looks like. Servers respond by slowing you down or refusing your IP address, and that address can end up on blocklists.
- The damage can spread. If your checks run from the same IP addresses or domain that sends your company's real email, a blocklisting hits your real email too.
- Corporate mail has extra layers. Many companies put a security gateway in front of their mail server, a filter that screens incoming connections. Some gateways greylist or throttle verification attempts specifically.
- Users can't wait. A signup form can't hold someone on a loading screen for several minutes while a retry runs.
Retrying has a place, but only as part of handling temporary failures properly, which starts with treating them as their own outcome.
How should your code handle a temporary failure?
The core fix is small: give your check three outcomes instead of two. Accepted, rejected, and retry later. A 4xx reply should never be collapsed into either of the first two.
A minimal classifier in Python might look like this:
def classify_rcpt_reply(code: int) -> str: """Classify the SMTP reply code returned after RCPT TO.""" if 200 <= code < 300: # Accepted. On a catch-all domain this proves nothing # about whether the person exists. return "accepted" if 400 <= code < 500: # Temporary failure: greylisting, rate limits, a busy server. # Not an answer about the mailbox. return "retry_later" if 500 <= code < 600: # Permanent failure, e.g. 550 5.1.1 (user unknown). return "rejected" return "unknown"
What you do with retry_later depends on where the check runs:
- At signup: don't block the user. Let them through, mark the address as unconfirmed, and verify it afterwards or confirm it another way, such as a confirmation link.
- In batch jobs: put the address in a retry queue with increasing delays between attempts, and cap the number of attempts so nothing retries forever.
- Everywhere: log the full reply code and text. 450 4.7.1 and 421 mean different things, and you will want the detail when something looks wrong.
That handles greylisting correctly. Whether it is worth running the check yourself at all is a separate question.
When should you hand the check to a verification service?
For a side project checking a few addresses a day, the classifier above may be all you need. A few signs suggest it's time to hand the check off instead:
- Business addresses make up a large share of your list. Company mail servers are where greylisting, security gateways and catch-all setups cluster.
- You're checking at volume. The more checks you run from your own IP addresses, the faster you run into rate limits and blocklists.
- Your app runs on cloud hosting. If outbound port 25 is restricted, you may not be able to run the check reliably at all.
- You need an answer, not "retry later." A product that has to decide now, such as a signup form or an automated sending tool, can't do much with a deferred result.
A verification service does the same basic job, but from infrastructure built for it: it manages retries and sending reputation across many servers, so the check isn't tied to your IP addresses, and it can combine the SMTP reply with other signals to reach a clear result.
What would that signup form have done differently?
Go back to the signup form that turned customers away. With three outcomes instead of two, the greylisted business signups would have come back as retry_later, not as failures. They would have been let through, checked properly afterwards, and the real customers among them would never have known there was an issue.
For developers who would rather not run that machinery themselves, Allegrow is a strong option. It resolves greylisting and rate limits automatically using a managed network of high-reputation IP addresses, returns clear valid or invalid results including on catch-all company domains, and offers both a free single-address checker that needs no account and an API that returns a result within the same request.
A temporary failure is a question deferred, not an answer. Code that respects the difference keeps both the list and the users.
Further Reading
Discover more articles on similar topics across our network
Best Snipe-IT Alternatives in 2026: 5 IT Asset Management Tools Compared
Stackademic



Comments
Loading comments…