This short article describes how to test an SMTP connection using a Telnet connection. It shows you haw to make a basic connection via a Telnet session to the SMPT server in question, manually load a message and exit again.
There is a useful test tool at NetworkTools, but doing it directly as described below does maintain some confidentiality and does the basic test before you may want to try a full test.
In the instructions below, you will need to change items shown in '[]' to match the system and mailbox you are testing. You need to be fairly prompt as some systems close the connection if you don't supply data quick enough. Also, you can't correct what you have typed! The systems expect you to be a computer sending predefined strings and always have the ability to type correctly - unlike most humans!
Start a Telnet session to your SMTP server on port 25. You will need either the IP address of your server or the FQDN (Fully Qualified Domain Name), replace this where [serverdomainname] is shown below:
You should get a response from the server. This message varies totally from system to system, so other than the number at the start of the line, anything could be returned. An example response is show below:
220 mail.[serverdomainname] Microsoft Exchange Internet Mail Connector 6.75
The header reply often contains the name of the server and the product you are talking with. In the example above, you are talking to the Microsoft Exchange Internet Mail Connector. But you could also be talking to PostFix or any one of the many SMTP systems that are around.
Next you need to identify who you are:
To which you should get a response similar to:
250 OK
Next you need to identify who the email message is from. You will probably need to supply a real email address, as many systems now check the source address out before processing the message. Also when you introduced yourself with the EHLO command, the from address may have to be from this domain too:
After that, you should get a message similar to:
250 OK - MAIL FROM [user]@[yourdomainname]
We can now provide the details of who you want the message to go to. This has to be a mailbox, alias or forward address that the system knows about, or you message will be rejected:
You should also get that acknowledged like:
250 OK - Recipient [user]@[serverdomainname]
There is other details you could send here, but this is the minimum. Next we need to tell the server that the message itself is coming:
And you will get a response like:
354 Send data. End with CRLF.CRLF
We can now send the actual message. First we will send the subject line of the message:
You need to send a blank line after the subject line. You won't get a response at this stage, you can now send the message:
.
Note the blank line with just a period '.'. This completes the message and you should then get a response like:
250 OK
The message has now been entered. You may also be advised of a message ID or something. Or maybe just the OK message. You should now close the transaction and close the session:
And you should drop back to your command prompt. Your message should be delivered if you received no error messages during this process.
If you want to reduce the errors while typing, here is the full text you can copy, modify and paste directly in once the Telnet session has been established:
MAIL FROM:[user]@[yourdomainname]
RCPT TO: [user]@[serverdomainname]
DATA
Subject: Test message
This is a test message you will not see a response from this command.
.
QUIT
Related posts:
- HowTo: Updating Elastix and CentOS via YUM As with all operating systems and software packages, updates are...
- Howto: Setting up NTPD One of the most important resources that a network of...
- HowTo: Asterisk VoiceMail Issues After setting up my new Elastix based FreePBX/Asterisk, the voice...
- HowTo: Quick install of cURL This short little HowTo details the process required to install...
- HowTo: Elastix Incoming SIP Trunk Calls For the last few weeks I have been bashing away...

Recent Comments