Troubleshooting SMTP Servers with Telnet From the Command Line (CLI)
03/26/2020 12 People found this article helpful 487,450 Views
Description
Troubleshooting SMTP Servers with Telnet From the Command Line (CLI)
Resolution
Telnet is a great tool to detect open TCP port connections through the Firewall. It is very effective in troubleshooting Exchange. Here are some commands that you can use to get valuable information.
First, DNS needs to be resolving to the correct mail exchanger record or MX record. Here is a response from an appropriately configured MX record.
type:
C:>nslookup
Default Server: mail.company.com
Address: ip.ip.ip.ip
Then type:
> set timeout=20 {enter}
> set type=mx {enter}
> company.com {enter}
The server's Response shows the MX pointer resolving to the appropriate domain name:
Server: mail.company.com
Address: ip.ip.ip.ip
company.com MX preference = 10, mail exchanger = mail1.company.com
company.com MX preference = 10, mail exchanger = mail.company.com
mail1.company.com internet address = ip.ip.ip.ip
mail.company.com internet address = ip.ip.ip.ip
Telnet to the MX record on port 25:
Telnet mail.company.com 25
Pressing carriage return or enter should give you the email server header and a timestamp:
220 exchange.company.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Wed, 16 Apr 2008 15:49:47 -0700
Then to ask the server what it's name is, type:
EHLO
250-exchange.company.com Hello [ip.ip.ip.ip]
250-TURN
250-SIZE 25088000 250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK
Below the hello! are the available commands to an unauthorized user. Unless the server supports anonymous login (open SMTP relay), you will not be able to Send mail.
Here is how you send email via the command line interface using manual SMTP commands:
telnet mail.company.com 25
login=user
password=password
EHLO company.com
MAIL FROM:USER@company.com
RCPT TO:USER@OTHERPLACE.COM NOTIFY=success,failure
DATA
response:
354 Start mail input; end with .
type:
Subject: Test from SonicWall email {enter} (Email messages require a carriage return between the subject: header field and the body.) This is a test message {enter} . {enter}
Mail will then queue with the following status indication:
> 250 2.6.0 Queued mail for delivery
disconnect by typing QUIT.
Related Articles
Categories
Was This Article Helpful?
YESNO