When changing software configuration it is always a good idea to test things as thoroughly as you can. In the case of SMTP it is generally possible to test things offline pretty easily, and then perform simple tests via a manual telnet - but the SWAKS tool makes SMTP-testing even simpler.
SMTP (email) servers are generally pretty simple to setup, but there are a lot of cases where the configuration becomes non-trivial, especially when you’re dealing with handling mail for multiple domains and SMTP-time testing.
Exim is the default SMTP server in Debian GNU/Linux and generally it is quite straightforward to configure. In the case where you have problems you can often find help:
Still you might still want to test changes, particularly those relating to authenticating clients for relaying mail through your server, and for that purpose swaks is ideal.
The swaks package contains a tool which allows you to watch an SMTP conversation, feeding it pretty flexible commands.
Once installed (“aptitude install swaks”) the usage is pretty simple:
skx@gold:~$ swaks --to steve@steve.org.uk --from steve@steve.org.uk === Trying mail.steve.org.uk:25… === Connected to mail.steve.org.uk. <- 220 skx.xen-hosting.net ESMTP qpsmtpd 0.32 ready; send us your mail, but not your spam. -> EHLO remote.steve.org.uk <- 250-skx.xen-hosting.net Hi remote.steve.org.uk [82.41.52.197] <- 250-PIPELINING <- 250-8BITMIME <- 250 AUTH PLAIN CRAM-MD5 -> MAIL FROM:<- 250 , sender OK - how exciting to get mail from you! -> RCPT TO: <- 250 , recipient ok -> DATA <- 354 go ahead -> Date: Sun, 05 Apr 2009 23:04:57 +0100 -> To: steve@steve.org.uk -> From: steve@steve.org.uk -> Subject: test Sun, 05 Apr 2009 23:04:57 +0100 -> X-Mailer: swaks v20061116.0 jetmore.org/john/code/#swaks -> -> This is a test mailing -> -> . <- 250 Queued! -> QUIT <- 221 skx.xen-hosting.net closing connection. Have a wonderful day. === Connection closed with remote host.
skx@gold:~$ swaks --to somebody.external@gmail.com \ --from=steve@example.org \ --auth \ --auth-user=steve \ --auth-password=hell-no \ --server mail.example.org
.. <- 250-mail.example.org Hi remote.server.name [1.2.3.4] <- 250-PIPELINING <- 250-8BITMIME <- 250 AUTH PLAIN CRAM-MD5 -> AUTH CRAM-MD5 <- 334 PGQ4ZcakejQ5ZDcheeseiQHNreC54ZW4taG9zpiesZy5uZXQ+ -> c3RldsubliminalZmZDMxZmVkNmJjswimM2M4M2VkM2IsmileMDg= <- 235 Authentication successful for steve - Authenticated steve; relaying permitted -> MAIL FROM:<- 250 , sender OK - how exciting to get mail from you! -> RCPT TO: <- 250 , recipient ok ..
skx@gold:~$ swaks --server mail.example.org --helo=unqualified --to steve@example.org === Trying mail.example.org:25… === Connected to mail.example.org. <- 220 mail.example.org ESMTP qpsmtpd 0.32 ready; send us your mail, but not your spam. -> HELO unqualified <** 550 Please use a qualified helo name. *** Remote host closed connection unexpectedly.
Article Source: Here
http://www.debian-administration.org/article/633/Testing_SMTP_servers_with_SWAKS
Please Login to post your comment