Using telnet to test your SMTP server: Difference between revisions

From RSWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 32: Line 32:


  RCPT TO:user@mydomain.com
  RCPT TO:user@mydomain.com
 
For some SMTP servers you may need to enclose the recipient e-mail address with <> as in the following:
For some SMTP servers you may need to enclose the recipient e-mail address with <> as in the following:


  RCPT TO:<user@mydomain.com>
  RCPT TO:<user@mydomain.com>
 
You should see this response:
You should see this response:



Revision as of 20:31, 4 August 2007

Use a telnet client to telnet to your mail server on port 25

telnet mail.mydomain.com 25

You should see a prompt like the the following:

220 mail.mydomain.com ESMTP server ready.

Enter the standard SMTP greeting with your hostname

HELO mail.testdomain.com

You should see the following reply:

250-mail.mydomain.com Hello mail.testdomain.com; ESMTPs are:

250-TIME

250-SIZE 0

250 HELP

We now need to tell the server who the mail is from. Type in the following:

MAIL FROM:user@testdomain.com

You should see the following response:

250 Sender OK - send RCPTs.

Now we need to enter the name of a recipient. Type in the following:

RCPT TO:user@mydomain.com

For some SMTP servers you may need to enclose the recipient e-mail address with <> as in the following:

RCPT TO:<user@mydomain.com>

You should see this response:

250 Recipient OK - send RCPT or DATA.

We are going to send some data so simply enter the following:

DATA

You should now see this response:

354 OK, send data, end with CRLF.CRLF

Now we enter our subject. After giving the subject you can hit enter and type a quick message. To send the message press enter after your last sentance and on a new line with a blank line above simply enter a full stop(period) on its own as the example below shows:

Subject: Test Message
This is a test message.

.

You should now recieve the following response:

250 Data received OK.

Thats it! All done and the mail has been sent. All that is needed is to issue the last and final command:

QUIT

And now we recieve the final output before the telnet session terminates:

221 mail.mydomain.com Service closing channel.