Send email using telnet

To test if our email server is working correctly we can use the following logic 🙂

1 – If we do now have sure of what is our email server address we can check it easily using nslookp.

Normally has any website our email server has to have a name associated to a ip address. If we want to confirm if the name is resolving to the correct ip address we will need to do a nslookup query.

Use the following syntax to confirm if the server has the correct address.

    1. nslookup
    2. set type=mx
    3. write the name of our domain e.g.: hjfr-info.com
    4. the return will be the name of the email server e.g.: mail.hjfr-info.com
    5. exit

eg:nslookup1

After this we can use this name to connect via telnet or resolve the name to a ip address.

now to start a telnet connection to the server we only need to write this on the command line:

1 – telnet mail.hjfr-info.com 25

if the connection is successfully established you should see something like this:

telnet SMTP Server 1

Now it is possible to begin sending a email.

  1. greet the server with a: Helo
  2. Identify yourself: MAIL FROM: hjfr@hjfr-info.com
  3. Identify the destination: RCPT TO:hjfr@hjfr-info.com
  4. Identify the Data that you want to send: DATA and write the data
  5. end with a . (point and enter)

The telnet also can be used to verify other things on the SMTP server.

For example we have the commands VRFY and EXPN that might be used to identify valid users.

VRFY = This command will request that the receiving SMTP server verify that a given email username is valid. The SMTP server will reply with the login name of the user. 

ESPN = is similar to VRFY, except that when used with a distribution list, it will list all users on that list. This can be a bigger problem than the “VRFY” command since sites often have an alias such as “all”.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.