Difference between revisions of "Using telnet to test your SMTP server"

From RSWiki
Jump to navigation Jump to search
 
Line 2: Line 2:
  
 
  telnet mail.mydomain.com 25
 
  telnet mail.mydomain.com 25
+
 
 
You should see a prompt like the the following:
 
You should see a prompt like the the following:
  
''220 mail.mydomain.com ESMTP server ready.''
+
''220 mail.mydomain.com ESMTP server ready.''
  
 
Enter the standard SMTP greeting with your hostname
 
Enter the standard SMTP greeting with your hostname
  
 
  HELO mail.testdomain.com
 
  HELO mail.testdomain.com
+
 
 
You should see the following reply:
 
You should see the following reply:
  
''250-mail.mydomain.com Hello mail.testdomain.com; ESMTPs are:''
+
''250-mail.mydomain.com Hello mail.testdomain.com; ESMTPs are:''
 
+
''250-TIME''
+
''250-TIME''
 
+
''250-SIZE 0''
+
''250-SIZE 0''
 
+
''250 HELP''
+
''250 HELP''
  
 
We now need to tell the server who the mail is from. Type in the following:
 
We now need to tell the server who the mail is from. Type in the following:
  
 
  MAIL FROM:user@testdomain.com
 
  MAIL FROM:user@testdomain.com
+
 
 
You should see the following response:
 
You should see the following response:
  
''250 Sender OK - send RCPTs.''
+
''250 Sender OK - send RCPTs.''
  
 
Now we need to enter the name of a recipient. Type in the following:
 
Now we need to enter the name of a recipient. Type in the following:
  
 
  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:
  
''250 Recipient OK - send RCPT or DATA.''
+
''250 Recipient OK - send RCPT or DATA.''
  
 
We are going to send some data so simply enter the following:
 
We are going to send some data so simply enter the following:
Line 47: Line 47:
 
You should now see this response:
 
You should now see this response:
  
''354 OK, send data, end with CRLF.CRLF''
+
''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:
 
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:
Line 58: Line 58:
 
You should now recieve the following response:
 
You should now recieve the following response:
  
''250 Data received OK.''
+
''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:
 
Thats it! All done and the mail has been sent. All that is needed is to issue the last and final command:
  
 
  QUIT
 
  QUIT
+
 
 
And now we recieve the final output before the telnet session terminates:
 
And now we recieve the final output before the telnet session terminates:
  
''221 mail.mydomain.com Service closing channel.''
+
''221 mail.mydomain.com Service closing channel.''
  
  
 
[[Category:Technical]][[Category:Web]]
 
[[Category:Technical]][[Category:Web]]

Latest revision as of 07:01, 4 May 2016

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.