Please subscribe to my feed.

You can subscribe by entering your email address below, and you will never miss any good posts by our panel of authors. Don't worry, you can unsubscribe ANYTIME.

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.

  1. Go to a DOS prompt
  2. Type “telnet”, hit Enter.
  3. Type “open mail.YourDomain.com 25″ (replace YourDomain.com with your domain name. And replace the default port 25 if necessary), hit Enter.
  4. Type “HELO”, hit Enter.
  5. Type “AUTH LOGIN”, hit Enter.

Your telnet window should look like the following now.

Telnet email

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”.

Authentication successful

OK, so far so good. You have just authenticated yourself with the mail server and now can start entering the email details.

  1. 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)

  2. Type “DATA”, hit Enter
  3. Type “Subject:Sending email using Telnet”, hit Enter
  4. Type “” (Send a blank line to separate the headers from the message body), hit Enter
  5. Type “This is just a simple test.”, hit Enter
  6. Type “.”, hit Enter

The server should respond with “250 OK”.
Type “quit” and hit Enter to exit.

SMTP email

Check your mailbox or if you sent it to somebody else ask that person if he or she receive the test email. :)

Notes:

  • 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 4.1.1.1″ 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 username@domainname.com size=100: malformed address: size=100 may not follow username@domainname.com”. 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!

Share this story with the world:
  • Digg
  • del.icio.us
  • MisterWong
  • Wists
  • BlinkList
  • Furl
  • Reddit
  • StumbleUpon
  • Technorati