Showing posts with label SMTP. Show all posts
Showing posts with label SMTP. Show all posts

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 

Cisco Unity Express SMTP problem FQDN in EHLO

Ever had the problem, because of a sub-optimal DNS implementation, that your CUE doesn't want to use the FQN in EHLO? Your SMTP Server keeps sending "Helo command rejected: need fully-qualified hostname"? Then you should try to set the CUE hostname via CLI. You could set it to something like "hostname CUE.lab.local". This doesn't work via GUI!!

Packet Capture with hostname CUE:
No.     Time        Source                Destination           Protocol Length Info
     14 26.796002   172.20.20.88       172.20.20.2       SMTP     98     S: 220 labstest.lab.local ESMTP Postfix
     16 26.796002   172.20.20.2       172.20.20.88       SMTP     62     C: EHLO CUE
     18 26.800002   172.20.20.88       172.20.20.2       SMTP     227    S: 250-labstest.lab.local | 250-PIPELINING | 250-SIZE 10485760 | 250-VRFY | 250-ETRN | 250-AUTH CRAM-MD5 GSSAPI | 250-STARTTLS | 250-ENHANCEDSTATUSCODES | 250-8BITMIME | 250 DSN
     19 26.804002   172.20.20.2       172.20.20.88       SMTP     82     C: MAIL FROM:<CUE@lab.local>
     21 26.812002   172.20.20.88       172.20.20.2       SMTP     66     S: 250 2.1.0 Ok
     22 26.812002   172.20.20.2       172.20.20.88       SMTP     90     C: RCPT TO:<andre@provider.de>
     24 26.812002   172.20.20.88       172.20.20.2       SMTP     123    S: 504 5.5.2 <CUE>: Helo command rejected: need fully-qualified hostname
     25 26.812002   172.20.20.2       172.20.20.88       SMTP     58     C: RSET
     27 26.816002   172.20.20.88       172.20.20.2       SMTP     66     S: 250 2.0.0 Ok
     28 26.816002   172.20.20.2       172.20.20.88       SMTP     58     C: QUIT
     31 26.816002   172.20.20.88       172.20.20.2       SMTP     67     S: 221 2.0.0 Bye

Packet Capture with hostname CUE.lab.local:
No.     Time        Source                Destination           Protocol Length Info
    111 840.239998  172.20.20.88       172.20.20.2       SMTP     98     S: 220 labstest.lab.local ESMTP Postfix
    113 840.243998  172.20.20.2       172.20.20.88       SMTP     79     C: EHLO CUE.lab.local
    115 840.243998  172.20.20.88       172.20.20.2       SMTP     227    S: 250-labstest.lab.local | 250-PIPELINING | 250-SIZE 10485760 | 250-VRFY | 250-ETRN | 250-AUTH CRAM-MD5 GSSAPI | 250-STARTTLS | 250-ENHANCEDSTATUSCODES | 250-8BITMIME | 250 DSN
    116 840.251998  172.20.20.2       172.20.20.88       SMTP     86     C: MAIL FROM:<CUE@lab.local>
    118 840.259998  172.20.20.88       172.20.20.2       SMTP     66     S: 250 2.1.0 Ok
    119 840.259998  172.20.20.2       172.20.20.88       SMTP     90     C: RCPT TO:<andre@provider.de>
    121 840.267998  172.20.20.88       172.20.20.2       SMTP     66     S: 250 2.1.5 Ok
    122 840.267998  172.20.20.2       172.20.20.88       SMTP     58     C: DATA
    124 840.267998  172.20.20.88       172.20.20.2       SMTP     89     S: 354 End data with <CR><LF>.<CR><LF>
    125 840.287997  172.20.20.2       172.20.20.88       SMTP     1500   C: DATA fragment, 1448 bytes
    174 840.303997  172.20.20.2       172.20.20.88       SMTP     1500   C: DATA fragment, 1448 bytes
    177 840.303997  172.20.20.2       172.20.20.88       SMTP     1500   C: DATA fragment, 1448 bytes
    178 840.303997  172.20.20.2       172.20.20.88       SMTP     1500   C: DATA fragment, 1448 bytes
    179 840.303997  172.20.20.2       172.20.20.88       SMTP     1500   C: DATA fragment, 1448 bytes
    180 840.303997  172.20.20.2       172.20.20.88       IMF      440    from: Cisco Unity Express <CUE@lab.local>, subject: Message Notification,  (text/plain) (audio/x-wav)
    189 840.307997  172.20.20.88       172.20.20.2       SMTP     89     S: 250 2.0.0 Ok: queued as 93155E8CE43
    190 840.307997  172.20.20.2       172.20.20.88       SMTP     58     C: QUIT
    193 840.311997  172.20.20.88       172.20.20.2       SMTP     67     S: 221 2.0.0 Bye