Being able to send email manually seems to be a bit of a lost art. It is extremely handy to know how to use telnet to send email for testing procmail filters, and any other part of your mail system. It can also be fun to spoof email to a friend or co-worker. Read on for a quick run down.
Open a connection to the mail server.
telnet mail.server.com 25
Now initiate the SMTP session. The host connecting to the remote SMTP server identifies itself by it’s fully qualified DNS host name, so be sure to replace localhost.localdomain with your sending servers FQDN.
MAIL indicates who is sending the mail. Any returned mail will be sent back to this address.
mail from: [email protected]
RCPT indicates who will be receiving the mail. You can indicate more than one user by issuing multiple RCPT commands.
rcpt to: [email protected]
DATA indicates that you are about to send the text (or body) of the message. The message text must end with the following five letter sequence: “\r\n.\r\n.”
From: Your Name
Subject: Very important
This is the first line
This is the second line
QUIT ends the SMTP session.