Send Mail Using Telnet
Yesterday we had installed the Telnet client on our Windows Vista. Today, letâs try to send an email using nothing but the Telnet client. This is a very good way to troubleshoot problems in sending emails in your email client such as Microsoft Outlook, and while at the same time you can learn the protocols which actually happen in the background when you press the âsendâ button in your email client.
What I listed below is the general commands that will work on most mail servers. If yours do not work, you will need to check whatâs the mail server you are currently running and change the commands slightly.
Go to a DOS prompt Type âtelnetâ, hit Enter.
Type âopen mail.YourDomain.com 25â³ (replace YourDomain.com with your domain name. And replace the default port 25 if necessary), hit Enter. Type âHELOâ, hit Enter.
Type âAUTH LOGINâ, hit Enter. Your telnet window should look like the following now.
Now, you now need to enter your full email address and then your password encoded in BASE64. To convert your full email address and your password to BASE64, you can use this handy BASE64 encoding tool. Enter your email, click on âEncodeâ, copy that encoded value in the telnet session and press Enter. After that do the same for your password.
If your username (the full email address) and password are entered correctly, the mail server should respond with âAuthentication successfulâ.
Type âMAIL FROM:YourUserName@YourDomain.com size=100â³ (replace YourUserName@YourDomain.com with your full email address. The size should be properly computed but I was lazy so I simply put in 100 and it worked on my mail server), hit Enter
Enter âRCPT TO:DestinationEmail@DestinationDomain.comâ (replace DestinationEmail@DestinationDomain.com with the destination email)
Type âDATAâ, hit Enter
Type âSubject:Sending email using Telnetâ, hit Enter
Type ââ (Send a blank line to separate the headers from the message body), hit Enter
Type âThis is just a simple test.â, hit Enter
Type â.â, hit Enter
The server should respond with â250 OKâ.
Type âquitâ and hit Enter to exit.
Check your mailbox or if you sent it to somebody else ask that person if he or she receive the test email.
If you entered the steps above wrongly or if you forgot one or two commands, the mail server might respond with â503 Bad sequence of commandsâ. If the mail server responded with something like â550 You have sent no HELO! Please see RFC 2821 section 220.127.116.11â³ to your HELO command, then you can try supplying your domain name following HELO. For example âHELO localhost.comâ. Some mail servers do not require the âsizeâ attribute and will respond with something like â501 email@example.com size=100: malformed address: size=100 may not follow firstname.lastname@example.orgâ. In this case just drop the size attribute. Our test emails are likely to end up in the spam box, so make sure you look into that folder if you couldnât find them in the inbox. I am no expert in SMTP email protocols, the above are just some guidelines to get you started. Have fun with SMTP emails and telnet!