SMTP HELO/EHLO Commands



                         SMTP HELO/EHLO Commands

The HELO/EHLO can be very helpful in case you wanna know what happens when you hit the SEND button to send a mail. So, in this post we'll work on sending a mail from the command prompt using the TELNET command. They are also some very useful commands that can be used while troubleshooting SMTP errors.

HELO (Hello)
The client sends this command to the SMTP server to identify it and initiate the SMTP conversation. The domain name or IP address of the SMTP client is usually sent as an argument together with the command (e.g. “HELO client.example.com”). If a domain name is used as an argument with the HELO command, it must be a fully qualified domain name (also called FQDN).


EHLO (Extended Hello)
Same as HELO but tells the server that the client may want to use the Extended SMTP (ESMTP) protocol instead. EHLO can be used although you will not use any ESMTP command. And servers that do not offer any additional ESMTP commands will normally at least recognize the EHLO command and reply in a proper way.

In windows 7 make sure to enable TELNET command from Windows Components.... http://blogs.technet.com/b/ferris/archive/2010/05/03/howto-enable-telnet-in-windows-7-and-vista.aspx

* Open command prompt using Admin credentials
*Type Telnet mail.teamxchange.in   and hit ENTER

In case you receive the following error: Connecting To mail.server.com....Could not open connection to the host, on port 25: Connect failed
This simply means the server that you're trying to work upon has secured port 25 and uses a different one or you have typed the incorrect mail domain name.

In case the settings are correct the reply should in the following format:
220-mail.teamxchange.in ESMTP
220 Welcome to

Now, we’ll connect using the HELO as well as EHLO commands and see the outputs.

Type HELO  and ENTER
The server here will reply with: 250 SMTP.teamxchange.com(meaning a connection has been made with SMTP server or the First Point of Contact server for the domain)

The EHLO command is a bit descriptive when called as its encrypted and Extended SMTP.
Type EHLO  and ENTER
The server here will reply with:
250-smtp.server.com
250-SIZE 1000000
250 AUTH LOGIN PLAIN CRAM-MD5

Now, authenticate using your ID and password but in BASE64 format.

Type:
AUTH LOGIN
334 VXNlcm5hbWU6(Here, the server has replied asking for the username in BASE64 encoded text)
We’ll reply the same using BASE64 format
Adlxdkej (Here we have replied with our username in BASE64 format)
334 UGFzc3dvcmQ6 (Here, the server is asking for the password in BASE64 encoded text)
lkujsefxlj (Here we have replied with our password in BASE64 format)

235 2.7.0 Authentication successful

Please find below the link to encrypt or decrypt data in BASE64 format:

So, now as we are authenticated, we’ll try to send mail.

Type MAIL FROM:
250 OK (Here the server has recognized the sender's id)
Type RCPT TO:
250 OK (Here the server has recognized the recipient's id)
Type DATA (this command is to ask the server to allow user to type content of the message)
354 Send message content (Now you can start typing the body of the message)
Type THIS IS A TEST MAIL (the mail body)
Type Subject: TEST Mail
(The “.” Here indicates the send command)
250 OK, message accepted for delivery: queued as 12345
Type QUIT
221 Bye










Comments

Popular Posts