Send mail the hard way - SMTP

SMTP, or Simple Mail Transfer Protocol, is a text-based protocol for sending email. We will need to use openssl, which is a tool that implements SSL and TLS protocols. Unlike Telnet, openssl will enable the encrypted connection required for sending mail through the gmail server.

To test this out with gmail on a Mac:

  1. openssl s_client -connect smtp.gmail.com:465 -quiet -crlf. The -quiet flag avoids renegotiating errors, and -crlf properly equates returns to CRLT, which signals end of message to SMTP.
  2. HELO gmail.com
  3. auth login
  4. You will see 334 VXNlcm5hbWU6, which says username in base64. Use this base64 encoder to get your username in base64, and enter into terminal.
  5. Do the same for 334 UGFzc3dvcmQ6, which is your password.
  6. MAIL FROM: <[email protected]>
  7. RCPT TO: <[email protected]>
  8. DATA
  9. Subject: + your subject
  10. Type a message
  11. End the message with a . on an otherwise empty line
  12. Typing quit closes the connection