Send mail via telnet / test for open relay

Published September 22, 2009 by Siva

First, determine the MX for the domain in question:

nslookup
set type=mx
mydomain.com

should return something like:Server: ns2.mydom.com
Address: 192.168.1.254
mydomain.com preference = 10, mail exchanger = mx.mydomain.com
mydomain.com nameserver = ns.mydomain.com
mx.mydomain.com.com internet address = 1.1.1.1
mx2.mydomain.com internet address = 1.1.1.2

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

So, armed with this knowledge,

telnet 1.1.1.1 25

Server responds with: 220 mx.mydomain.com SMTP
HELO

Server responds with: 250 OK
MAIL FROM:user@mydomain.com

Server responds with: 250 Address Ok.
RCPT TO:user@otherdomain.com

Server responds with: 250 user@otherdom.com OK
DATA

Server Responds (or may not): 354 Enter Mail
Enter message, then on a new line,
.

exit

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

Advertisements

One comment on “Send mail via telnet / test for open relay

  • Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

    %d bloggers like this: