Send Mail Via Telnet /Test for Open Relay

Posted February 9, 2004 by Al Banks in Sendmail

Behind the scenes, the commands sent to mail servers are simple text commands. These commands can be sent to an email server manually via Telnet. This is a quick way to test an email server to determine if it is an open relay.

First, determine the MX for the domain in question:

set type=mx

This should return something like such as the following: Server: ns2.mydom.com
mydom.com preference = 10, mail exchanger = mx.mydom.com
mydom.com nameserver = ns.mydom.com
mx.mydom.com.com internet address =
mx2.mydom.com internet address =

The last two lines tell you about the mail server (MX = Mail Exchange). In this case, and

So, armed with this knowledge, note the following examples:

telnet 25

Server responds with: 220 mx.mydom.com SMTP

Server responds with: 250 OK
MAIL FROM:[email protected]

Server responds with: 250 Address Ok.
RCPT TO:[email protected]

Server responds with: 250 [email protected] OK

Server Responds (or may not): 354 Enter Mail
Enter message, and then on a new line, enter the following;


The message should now be sent. By modifying the MAIL FROM and RCPT TO lines, you can test for open relay.

The Conversation

Follow the reactions below and share your own thoughts.

Leave a Reply