Sending email via telnet can be useful when testing your sendmail/postfix or in a bind. This howto gives you the basic unencrypted AUTH LOGIN method. It's not the best method but it's probably the most supported.
Step 1:
Base 64 encode your username and password. I found some javascript online that does it but none of them seemed to work right so here's how I did it with PHP:
echo 'Username: ' . base64_encode('username') . "\n"; echo 'Password: ' . base64_encode('password') . "\n";
For example, "demo" turns into ZGVtbw==
Step 2:
Open your telnet client and connect to the SMTP server, port 25:
telnet mail.mydomain.com 25
You should see something like this:
Connected to mail.mydomain.com.
Escape character is '^]'.
220 mail.mydomain.com ESMTP Postfix
Step 3:
Send it back a EHLO (Extended Hello).
ehlo mail.mydomain.com
Step4:
You'll receive a response back with stuff like this:
250-mail.mydomain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250 8BITMIME
The important part of this response is that "AUTH" and "LOGIN" exist on the same line. AUTH PLAIN LOGIN means it can authenticate with PLAIN or LOGIN (we're going to use LOGIN).
Step 4:
Reply that we'll be using LOGIN, followed by the Base 64 encoded username and password (in that order).
AUTH LOGIN {ENCRYPTED USERNAME} {ENCRYPTED PASSWORD}
Step 5:
Write who it's from and who it's going to. This is how your mailer knows where to send the email. Here's an example:
mail from: rcpt to:
Step 6:
Write "data" and then you can start writing your email. Notice that From: and To: are specified again. This time, it's for the email clients so this can differ from what you wrote above.
data From: To: Subject: Why wont these test emails work this one better go through!!!
Step 7:
Last step, put a blank line and then a line that only includes a period:
.
You're done. You may get booted out of the system immediately or you can use the escape character you received when you connected. Mine was: Escape character is '^]'. this means CONTROL ]