Menu

#11 Email validation incorrectly requires recipient domain to respond on port 80

1.0
closed
None
2026-08-11
2026-08-10
No

PHPMailerPro considers an email address invalid if the recipient domain does not accept connections on TCP port 80.
A valid mail domain does not need to run a web server. Domains used exclusively for email may have valid MX records while having no web service at all.
In this case, EmailExtractEmail() returns false. This eventually results in PHPMailerPro sending:
RCPT TO: <>
The SMTP server then responds with a misleading error such as:
501 <>: missing or malformed local part
This was reproducible with valid email addresses on mail-only domains.

Current code in IsValidEmail():
$check = @fsockopen($domn, 80, $errno, $errstr, 1);

Suggested fix
Remove the call to IsValidEmail() from EmailExtractEmail() and rely on PHP's built-in email syntax validation:

if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
    return $email;
}

return false;

Whether the recipient is actually deliverable should be left to the SMTP/mail server. A failed delivery will then result in a meaningful SMTP response or bounce.

function IsValidEmail() can be deleted.

Discussion

  • Andy Prevost (CodeworxTech)

    confirmed, fix as reported (contained in Aug 10 2026 release).

     
  • Andy Prevost (CodeworxTech)

    • status: open --> closed
     

Log in to post a comment.