Tuesday, July 19, 2011

Ever wanted to test a SMTP mailserver manually?

Just telnet to your mailservers TCP port 25 and enter the following commands (green):

Host#telnet 172.20.20.88 25
Trying 172.20.20.88, 25 ... Open
220 mailserver.lab.local ESMTP Sendmail 8.13.8/8.13.8/Debian-2; Tue, 19 Jul 2011 21:52:12 +0200; (No UCE/UBE) logging access from: host.lab.local(OK)-host.lab.local [172.20.20.89]
EHLO host.lab.local
250-mailserver.lab.local Hello host.lab.local [172.20.20.89], pleased to meet youH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
MAIL FROM:<test@mailserver.lab.local>
250 2.1.0 <test@mailserver.lab.local>... Sender ok
RCPT TO:<andre@lab.local.de>
250 2.1.5 <andre@lab.local.de>... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
subject:Test
text, text, text, text, text, text, text, text, text, text, text, text,
text, text, text, text, text, text, text, text, text, text, text, text,
bla ...
.
This final dot (.) is crucial. Type it, and then hit enter. This finishes your mail.
250 2.0.0 a7JJwA7887a979 Message accepted for delivery
QUIT
221 2.0.0 mailserver.lab.local closing connection

[Connection to 172.20.20.88 closed by foreign host]
Host#

Thats it. If you see errors you don't know how to fix, check these links:
http://www.samlogic.net/articles/smtp-commands-reference.htm
http://email.about.com/cs/standards/a/smtp_error_code.htm
http://www.answersthatwork.com/Download_Area/ATW_Library/Networking/Network__3-SMTP_Server_Status_Codes_and_SMTP_Error_Codes.pdf 
http://www.hosteng.com/faqfiles/SMTP%20Server%20Status%20Codes%20and%20Errors.pdf 

No comments: