How to check if an email address exists without sending an email?

How to check if an email address exists without sending an email?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Verifying Email Addresses via SMTP Without Sending Messages

When building a registration form or a password reset flow, you often need to distinguish between a typo and a non-existent user before attempting to send a verification email. Sending an actual email just to check existence is wasteful and can trigger spam filters if your application sends hundreds of test messages. The standard approach for this is the SMTP VRFY command, though its availability has become inconsistent across modern mail servers.

The most reliable method involves checking the mailbox expansion capabilities of a specific server using the RCPT TO command within an SMTP session without actually transmitting data. This technique allows you to verify if a user exists on a remote server by attempting to "connect" to their mailbox and observing the server's response code before any message content is queued.

The logic relies on the fact that mail servers must respond when an address is explicitly targeted during a session, even if no email body follows. You establish a connection to the target domain's MX records, authenticate if required, and then send the RCPT TO command with the full email address in question. The server will respond with a 250 code if the address is valid, or a 550 code if it does not exist or is rejected.

Here is a conceptual breakdown of how this works in practice:

function checkEmailExistence($email) {
    $domain = explode('@', $email)[1];
    $serverName = getmxhost($domain); // Or resolve via DNS lookup
    
    $smtp = new Swift_Smtp_Transport();
    $smtp->setHost($serverName, null, 8025); // Example port, adjust per target
    
    $response = $smtp->executeCommand(
        "EHLO {$serverName}", 
        "MAIL FROM:<test@example.com>", 
        "RCPT TO:<{$email}>"
    );
    
    return strpos($response[1], '250') !== false;
}

In this example, the function attempts to initiate a transaction. If the RCPT TO command returns a 250 status code, the address is considered valid for that specific mailbox server. If it returns a 550 or 553 error, the account likely does not exist.

However, there are significant caveats to consider. Many modern mail servers, particularly those running Postfix or Exim, have disabled the VRFY command entirely due to privacy and spam abuse concerns. Consequently, relying solely on RCPT TO responses can sometimes yield false negatives because the server might reject the attempt even if the user is valid, simply because it blocks that specific verification vector.

Additionally, you must account for the fact that this verification is domain-specific. An email like user@company.com might be valid on Company A's servers but invalid on Company B's. If your application does not have a direct SMTP relationship with every user's provider, you cannot universally validate their address without knowing exactly which mail server handles their domain.

Another critical limitation involves the distinction between "does not exist" and "mailbox full." Some servers return 550 for both scenarios, making it impossible to differentiate between a typo and a quota issue without further inspection. Furthermore, some servers may delay responses or require specific authentication headers that standard client libraries do not handle automatically.

If you are working within the Laravel ecosystem, you can leverage existing SMTP transport classes to construct these raw commands safely. However, always remember that this method should be used as a secondary check. Relying on it as the primary validation mechanism risks confusing users with "address invalid" errors when the real issue is a server configuration change on the receiving end.

For robust applications, the most common pattern is to skip pre-send verification entirely and instead rely on bounce handling or immediate delivery confirmation. This reduces the complexity of your logic and avoids the fragility of depending on third-party mail server configurations that you cannot control.

Our network