SMTP command line
Using the SMTP command line is extremely useful to troubleshoot email issues, as well as script the sending of email. It is also useful to test your mail server to determine if you have an open relay. Just telnet to port 25 of the server like:
telnet mail.domain.com 25
HELO
At a command line to connect. Then you need to send a helo or ehlo line to identify yourself:
ehlo domain.com
If you do not need to authenticate, just send a mail from address (see below) to specify from which email account you will be sending the email. If authentication is required, see the following:
Authentication
After sending a HELO, if your server requires authentication, either send:
auth login
or
auth gssapi
gssapi refers to Generic Security Services Application Programming Interface. It is essentially a generic API typically used with Kerberos 5. More information can be found in RFCs 2743, 1509 and 1964.
You then need to authenticate, usually with the email address of a user on the mail server, along with the password. This needs to be converted t base64. You can convert to base64 at this website, or just Google base64 encoder. http://www.motobit.com/util/base64-decoder-encoder.asp
Mail From
You then need to specify which email is sending the email with the following command:
mail from:user@domain.com
Notice the use of the spacing and lack of spacing. It has to be exact. If you are able to specify any old user from any old domain, you probably have an open relay! Open relays are bad, because email can be sent through your email server and spoofed, resulting in spam being propagated across the internet, and labeling your IP address as a spam generator with such organizations as SPAM Cops, SPAM Haus, etc. These services are DNSBL or DNS Blacklists. A lot of organizations refer to these DNSBL’s to block unwanted spam from their organizations, so you don’t want to be listed. If you ever get listed, follow the procedure to get unlisted. There are several sites out there that will check your domain against multiple DNSBL’s or RBL’s (realtime blackhole lists).
Rcpt To
You then need to specify a recipient of the email with the following command:
rcpt to:user@otherdomain.com
This specifies who the email is going to.
Data
Now it’s time to form the email so just issue the command:
data
You can then start typing the body of the email. You can also specify the subject line by typing:
Subject:<subject goes here>
The body of the message can also include several header items like Date, Subject, To, Cc, and From. Hit carriage return to start typing the body of the message. When you’re done, hit another carriage return and just enter a period with nothing else, and hit enter. The message will be queued and sent out if everything was successful!

1
[...] Vote SMTP command line [...]