Skip to content

Instantly share code, notes, and snippets.

@jwmerrill
Created September 9, 2013 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwmerrill/6502014 to your computer and use it in GitHub Desktop.
Save jwmerrill/6502014 to your computer and use it in GitHub Desktop.
Example of validating an e-mail address by looking up the SMTP server and seeing how it responds to RCPT TO: messages.
jason:knox jm843$ host gmail.com
gmail.com has address 74.125.239.53
gmail.com has address 74.125.239.54
gmail.com has IPv6 address 2607:f8b0:4010:801::1016
gmail.com mail is handled by 30 alt3.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 10 alt1.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 20 alt2.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 5 gmail-smtp-in.l.google.com.
gmail.com mail is handled by 40 alt4.gmail-smtp-in.l.google.com.
jason:knox jm843$ nc alt3.gmail-smtp-in.l.google.com 25
220 mx.google.com ESMTP k5si3310486qcp.33 - gsmtp
HELO
250 mx.google.com at your service
MAIL FROM:<bob@example.com>
250 2.1.0 OK k5si3310486qcp.33 - gsmtp
RCPT TO:<sergey@gmail.com>
250 2.1.5 OK k5si3310486qcp.33 - gsmtp
RCPT TO:<lolwtf>
553-5.1.2 We weren't able to find the recipient domain. Please check for any
553-5.1.2 spelling errors, and make sure you didn't enter any spaces, periods,
553 5.1.2 or other punctuation after the recipient's email address. k5si3310486qcp.33 - gsmtp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment