Mail Toaster Testing

From The Network People, Inc. - Wiki
Jump to navigation Jump to search

Testing

Mail::Toaster comes with an extensive suite of tests. The tests make sure all of the programs are installed, processes are running, authentication works properly, and mail filtering works. All of the tests can be run with a single command:

toaster_setup.pl -s test

Individual test targets are also available:

toaster_setup.pl -s filtertest
toaster_setup.pl -s authtest
toaster_setup.pl -s proctest
toaster_setup.pl -s imap|pop3|smtp


Log Watching

Watching the log files is often quite helpful.


Webmail Tests

Point your web browser at your mail server. Sign in and test all the features.


Remote Email

Send some emails to an email address on your new server. Swaks is in the contrib directory of the Mail::Toaster distribution.

swaks -t test@jail.example.com -s jail.example.com
=== Trying jail.example.com:25...
=== Connected to jail.example.com.
<-  220 jail.example.com ESMTP
-> EHLO imac24.example.com
<-  250-jail.example.com
<-  250-STARTTLS
<-  250-PIPELINING
<-  250-8BITMIME
<-  250-SIZE 0
<-  250 AUTH LOGIN PLAIN CRAM-MD5
-> MAIL FROM:<matt@imac24.example.com>
<-  250 ok
-> RCPT TO:<test@jail.example.com>
<-  250 ok
-> DATA
<-  354 go ahead
-> Date: Wed, 30 Jun 2010 14:28:18 -0700
-> To: test@jail.example.com
-> From: matt@imac24.example.com
-> Subject: test Wed, 30 Jun 2010 14:28:18 -0700
-> X-Mailer: swaks v20061116.0 jetmore.org/john/code/#swaks
-> 
-> This is a test mailing
-> 
-> .
<-  250 ok 1277933307 qp 18474
-> QUIT
<-  221 jail.example.com
=== Connection closed with remote host.


Then check the headers on the email. They should look something like this.

Received: (qmail 18480 invoked by uid 89); 30 Jun 2010 21:28:27 -0000
Received: by simscan 1.4.0 ppid: 18473, pid: 18474, t: 7.9843s
    scanners: attach: 1.4.0 clamav: 0.96.1/m:52/d:11297 spam: 3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on jail.example.com
X-Spam-Level: 
X-Spam-Status: No, score=-0.9 required=5.0 tests=ALL_TRUSTED,MISSING_MID
   	autolearn=no version=3.3.1
Received: from unknown (HELO imac24.example.com) (10.0.1.207)
    by jail with SMTP; 30 Jun 2010 21:28:19 -0000
Received-SPF: none (jail: domain at imac24.example.com does not designate permitted sender hosts)
Date: Wed, 30 Jun 2010 14:28:18 -0700
To: test@jail.example.com
From: matt@imac24.example.com
Subject: test Wed, 30 Jun 2010 14:28:18 -0700
X-Mailer: swaks v20061116.0 jetmore.org/john/code/#swaks

If you don't have the X-Spam headers or the Received: by simscan lines, then you probably haven't enabled filtering yet. Edit ~vpopmail/etc/tcp.smtp, uncomment the QMAILQUEUE=simscan (2nd to last line), and run 'qmail cdb'. Then send another test email. Here's some more swaks tests that should all work:

swaks -t test@jail.example.com -s jail.example.com -tls
swaks -t test@jail.example.com -s jail.example.com -p 587
swaks -t test@jail.example.com -s jail.example.com -tls -p 587 
swaks -t test@jail.example.com -s jail.example.com -tls -p 587 -a