Please subscribe to my feed.
Should you want to join Kongtechnology.com, please read here
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”.
OK, so far so good. You have just authenticated yourself with the mail server and now can start entering the email details.
- 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 188.8.131.52” 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!