Testing your mail servers


To quickly test an imap server using telnet use:

telnet server 143
01 LOGIN username password
02 LIST "" *
03 SELECT mailbox

Line 02 shows you all available mailboxes.

To show the information about a mailbox:

04 STATUS mailbox (MESSAGES)

Between () you can place one or more of the following: MESSAGES, UNSEEN, RECENT UIDNEXT UIDVALIDITY

And one of the following commands to view the a message 1 is the first message * is wildcard for all:

05 FETCH 1 ALL # All IMAP headers
05 FETCH 1 FULL # Full headers and body info
05 FETCH 1 BODY # Body
05 FETCH 1 ENVELOPE # Envelope
05 FETCH * FULL # All email

To fully retrieve a message use:

06 UID fetch 1:1 (UID RFC822.SIZE FLAGS BODY.PEEK[])


1. Telnet into Exchange server hosting IMS service using TCP port 25. Command is

telnet <servername> 25

2. Turn on local echo on your telnet client so that you can see what you are typing. On Win 9x and NT 3.5/4.0 Telnet client this done by selecting the “preferences” from the “terminal” pull down menu, and checking the local echo radio button. For Windows 2000 telnet client, issue command “set local_echo”, from the telnet command prompt.

3. Issue the following smtp command sequence

helo <your domain name><enter>                  
response should be as follows
250 OK

mail from: <your Email Address><enter>
response should be as follows
250 OK - mail from <your Email address>

rcpt to: <recipient address><enter>
response should be as follows
250 OK - Recipient <recipient address>

response should be as follows
354 Send data.  End with CRLF.CRLF

To: <recipient's display name><enter>
From: <your display name><enter>
Subject: <Subject field of Email message><enter>
<Enter you body text><enter><enter> . <enter>
response should be as follows
250 OK



SMTP AUTH is a little different but not difficult. First you will need to generate a Base64 instance of your login username and password before you proceed. To do so execute the following while replacing USERNAME and PASSWORD as needed.

USER@HOST ~$ perl -MMIME::Base64 -e 'print encode_base64("USERNAME@DOMAIN.TLD");'

USER@HOST ~$ perl -MMIME::Base64 -e 'print encode_base64("PASSWORD");'

Once you have your Base64 encoded username and password just login to the mail server as you did above. Remember that all lines below that start with a 3 digit number are responses from the mail server:

mp-mol:/var/log# telnet smtp.domain.tld 25
Trying xxx.xxx.xxx.xxx...
Connected to smtp.domain.tld.
Escape character is '^]'.
220 smtp.domain.tld ESMTP Postfix

Your response.

EHLO smtp.domain.tld

Server response.

250-SIZE 52428800

Your response.


Server response (Base64 encoded request for your USERNAME).

334 VXNlcm5hbWU6

Your response.


Server response (Base64 encoded request for your PASSWORD).

334 UGFzc3dvcmQ6

Your response.


Server response.

235 Authentication succeeded

Afterwards continue as in the previous example for testing an SMTP server/account.


To test ClamAV, send yourself a email with ONLY the following line within body:


You email client should prompt you an error message and block your mail delivery.

To test SpamAssassin, send yourself an email with ONLY the following line within body:


After mail delivery, when you check the received email source code, you should have similar message within header. If you are using Thunderbird and enable junk filtering within your mail account setup, this message will even move to “Junk” folder directly:

X-Spam-Flag: YES
X-Spam-Score: 1000.0
X-Spam-Level: +++++++++++++++++++++++++++++++++++++++++++++++++++
X-Spam-Report: Spam detection software, running on the system "mail.example.com", has
        identified this incoming email as possible spam.  The original message
        has been attached to this so you can view it (if it isn't spam) or label
        similar future email.  If you have any questions, see
        the administrator of that system for details.
        Content analysis details:   (1000.0 points, 5.0 required)
        pts rule name              description
        ---- ---------------------- --------------------------------------------------
        -1.4 ALL_TRUSTED            Passed through trusted hosts only via SMTP
        1000 GTUBE                  BODY: Generic Test for Unsolicited Bulk Email
        1.4 AWL                    AWL: From: address is in the auto white-list
/var/customers/webs/cw01/wiki/data/pages/mail/testing_the_server.txt · Last modified: 2013/02/18 09:38 by wadmin
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki