Sending email from a telnet session
Lately I have found myself needing to test a SMTP server setup. And, being the lazy developer I am, I didn’t want to write a full blow program for something I can accomplish with a simple telnet window. Of course I always manage to forget how to do this, so I decided to write it down finally. (note: you only enter the command preceded by an angle bracket >)
220 smtp.domain.com ESMTP Postfix > EHLO smtp.domain.com 250-smtp.domain.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN > AUTH PLAIN AHVzZXJuYW1lAHBhc3N3b3Jk 235 2.7.0 Authentication successful > MAIL FROM:user@domain.com 250 2.1.0 Ok > RCPT TO:user@domain.com 250 2.1.5 Ok > DATA 354 End data with <CR><LF>.<CR><LF> > A test...nothing more > . 250 2.0.0 Ok: queued as EC7BF38001 > quit 221 2.0.0 Bye Connection to host lost.
Just a few notes:
- Type a period then hit return to end the data collection part.
- To get the base-64 encoded password use the following Perl snippet:
perl -MMIME::Base64 -e \ 'print encode_base64("\0username\0password");'


