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.
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:
maniac6500
February 21st, 2008 at 12:51 pm
i am getting the error
could not open connection to the host , on port 25: connect failed
i am trying for the gmail so i tried on port 465 which was provided by the google settings
tell me what r the possible ways to resolve the issue?
Sifiso Kubuli
November 12th, 2008 at 11:07 pm
Hi There,
I have been trying the authentication process for Telnel and
i have entered my correct encoded address and this is what i get..
220 valley.new.co.za ESMTP Sendmail 8.11.6/8.11.6; Wed, 12 Nov 2008 16:54:42 +02
00
ehlo take2
250-valley.new.co.za Hello dsl-242-215-251.telkomadsl.co.za [41.242.215.251], pl
eased to meet you
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE 15029589
250-DSN
250-ONEX
250-XUSR
250-AUTH GSSAPI
250 HELP
auth gssapi
334
c2l5YUBnbWFpbC5jb20=500 5.7.0 authentication failed
Please help…
Your co-operation will be appreciated.
Regards
John Gooch
January 31st, 2009 at 12:53 am
So, you want me to enter my username and password someone else’s Web site so that can capture it and have it? No thanks. Are there any desktop application version of the Base64 converter?
Pooja Gupta
February 8th, 2009 at 7:16 pm
Hi, I have read the information above adn have done exactly as you said. I dont get an error from the smtp server.
My smtp server address is mail.infostretch.com and im trying to connect to it through telnet on port 25.
I did as you have said above. In the test mail, i am sending a test email from my infostretch account to myself.
The mail does come through, but its completely blank.
It lands up in the spam box and is completely blank. No sender, no recepient address and no body too.
Can u please advice???
Ajit
June 10th, 2009 at 4:37 pm
Hi There,re,
After entering the RCPT TO: email address
I get an error saying email address rejected.
Please advise.
David
July 4th, 2009 at 4:07 am
I followed the exact procedure but rather then displaying from email address in the test mail it displayed “Unknown Sender”
Why?
Alan Brookland
February 18th, 2010 at 7:48 pm
@John Gooch – your username and password doesn’t go to the website, the encoding is done by Javascript and so never leaves your browser and is never sent to the website for capturing.
I checked before using it myself and it’s perfectly safe – in fact there’s always a chance that any app you download could capture and transmit data if you haven’t got a good firewall blocking it.
Mick
March 24th, 2010 at 8:10 am
Many thanks for an enlightening article. Been stuck trying to authenticate via telnet and didn’t realise needed base 64. In reply to John’s post – what about in private browsing?