SMTP_Validate_Email — Email verification via SMTP written in PHP +

Working on a recent project I noticed that about 20% of user’s accounts have not been fully activated (typos in email addresses and/or bounced activation emails being the main culprits). After trying out several solutions (and realizing none of them worked for me), here’s my solution (pasting and excerpt from the README):

SMTP_Validate_Email – Perform email address verification via SMTP.

The class retrieves MX records for the email domain and then connects
to the domain’s SMTP server to try figuring out if the address is really valid.

Some features (check the source for more):

  • Not really sending a message, gracefully resetting the session when done
  • Command-specific communication timeouts implemented per the relevant RFCs
  • Catch-all account detection
  • Batch mode processing supported
  • MX query support on Windows without requiring any PEAR packages
  • Logging and debugging support

The source is over on Github: http://github.com/zytzagoo/smtp-validate-email

One Response to “SMTP_Validate_Email — Email verification via SMTP written in PHP”

  1. Should be very useful. Thank you for writing this article

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">