Sending mail from telnet session

This procedure is commonly used to troubleshoot SMTP hosts. In combination with an nslookup query for MX records for a domain (listed after this) you can successfully figure out if a given domain can receive internet email successfully.

  1. Open a telnet session to an SMTP server – let’s say foo.mydomain.com – or an IP address
    telnet foo.mydomain.com 25

    220 foo.mydomain.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1289 ready at Wed, 19 Oct 2005 10:27:34 -0700

  2. Now you can say where you’re sending mail from using HELO
    helo foo2.somedomain.com

    250 foo.mydomain.com Hello [65.239.32.15]

  3. Provide sender’s address
    MAIL FROM:[email protected]

    250 2.1.0 [email protected]….Sender OK

  4. Provide recipient’s address
    rcpt to:[email protected]

    250 2.1.5 [email protected]

  5. To start message content, issue the DATA command
    DATA

    354 Please start mail input.

  6. Enter the Subject
    Subject: This is a test
    (hit Enter for a blank line)
  7. Type in the body
    This is a test from [email protected]
  8. To end the message, enter a dot on a new line followed by Enter
    .

    250 Mail queued for delivery.

  9. Close the connection
    quit

    221 Closing connection. Good bye.

How to determine the mail exchanger (MX) for a domain

You can use the following procedure to determine the mail servers designated as “mail exchangers” for a domain. This is done by inserting an MX record for those servers in the DNS. Best practice for MX records is to point them to A records. A records are simple hostname to IP address mappings. Pointing MX records to CNAME records may result in performance issues.

From a command prompt, type:
nslookup -querytype=MX somedomain.com

This should produce output similar to the following:

Server: ns1.mydomain.com
Address: 192.168.1.10
 
Non-authoritative answer:
somedomain.com MX preference = 10, mail exchanger = mx1.somedomain.com
somedomain.com MX preference = 20, mail exchanger = mx2.somedomain.com
mx1.somedomain.com internet address = x.x.x.x
mx2.somedomain.com internet address = x.x.x.x

Written by

Bharat Suneja

Leave a Comment

Your email address will not be published. Required fields are marked *