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:
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.
- You will see
334 VXNlcm5hbWU6, which says username in base64. Use this base64 encoder to get your username in base64, and enter into terminal.
- Do the same for
334 UGFzc3dvcmQ6, which is your password.
MAIL FROM: <[email protected]>
RCPT TO: <[email protected]>
Subject:+ your subject
- Type a message
- End the message with a
.on an otherwise empty line
quitcloses the connection