Telnet to port 25 to Test SMTP communication
December 2, 2008 – 15:05 by Tom Van den BergBasic Testing
Test the smtp communication via Telnet (you can use a telnet client like putty).
You can start a Telnet session by using the Telnet command in the following format:
telnet mail.domainname.tld 25If the command works, you receive a response from the SMTP server that is similar to the following:
Trying 85.000.000.000... Connected to mail.domainname.tld. Escape character is '^]'. 220 hostname.domainname.tld ESMTP
Start communication by typing the following command:
EHLO domainname.tld
If the command is successful, you receive the following response:
250-hostname.domainname.tld 250-AUTH=LOGIN CRAM-MD5 PLAIN 250-AUTH LOGIN CRAM-MD5 PLAIN 250-STARTTLS 250-PIPELINING 250 8BITMIME
Or something like this:
250 OKType the following command to tell the receiving SMTP server who the message is from:
MAIL FROM:Admin@domainname.tld250 okType the following command with the SMTP address of the person you want to send to:
RCPT TO: User@domainname.tldYou receive the following response:
250 okType the following command to tell the SMTP server that you are ready to send data:
DATA
You receive the following response:
354 Send data. End with CRLF.CRLFYou are now ready to start typing the 822/2822 section of the message. The user will see this part of the message in their inbox. Type the following command to add a subject line:
Subject: test messagePress ENTER two times. You do not receive a response from this command.
Note The two ENTER commands comply with Request for Comments (RFC) 822 and 2822. 822 commands must be followed by a blank line.
Type the following command to add message body text:
This is a test message you will not see a response from this command.Type a period (.) at the next blank line, and then press ENTER. You receive the following response:
250 OKClose the connection by typing the following command:
QUIT
You receive the following response:
221 closing connectionVerify that the recipient received the message that you sent. If any error event messages appear in the application event log, or if there are problems receiving the message, check the configuration or the communication to the host.
Advanced Testing
In addition to the basic testing steps that are listed in this article, you can use a delivery receipt to test mail in both directions. You can use this method to verify that the SMTP server can accept an inbound connection and generate a delivery receipt back to the sender to test outbound connectivity of the SMTP server.
Give in the following command after the DATA-command:
RCPT TO:User@Domainname.tld notify=success,failure
One Response to “Telnet to port 25 to Test SMTP communication”
To test an IMAP connection, telnet to port 143.
telnet mail.domainname.tld 143
You’l get a response like this:
# telnet mail.domainname.tld 143
Trying xxx.xxx.xxx.xxx…
Connected to mail.domainname.tld (xxx.xxx.xxx.xxx).
Escape character is ‘^]’.
* OK The Microsoft Exchange IMAP4 service is ready.
By Tom Van den Berg on Dec 28, 2009