BLOG

SWAKS: the SMTP Swiss Army Knife

flash_m_laser_1200_900
SWAKS is a general purpose testing tool for SMTP. For basic SMTP testing it’s a more convenient, scriptable alternative to running a transaction by hand, but it also lets you test things that are difficult to do manually, such as authentication or TLS encryption.
It’s a perl script that installs fairly easily on OS X or any Linux/unix system (and can be installed on Windows, if you have perl installed there).
It’s pretty well documented, but it can be a bit overwhelming to start with. Here are some simple recipes:
Send a test email:

Check to see if a recipient exists:

Send via a particular server:

Test user authentication for a smarthost:

Test to see if a server supports opportunistic TLS:

(The backslashes are just there to split a single command line into two, so you can read it easily on this narrow blog).
SWAKS has a lot of other tricks too – adding headers, using specific protocols and ports, attaching content. It’s a very useful tool, and gets even more so when you add a little bit of shell scripting to automate your testing further.

5 comments

  1. Richard Siddall says

    Don’t forget to run “swaks –support” to see which extra Perl modules you can install to round out the capabilities of swaks.
    It’s in EPEL if you’re using RedHat/CentOS/etc.

  2. steve says

    Yes! It’ll run out of the box with minimal dependencies, but a lot of the more useful features (authentication and TLS especially) need those extra modules.

  3. Matt Heffelfinger says

    Swaks is awesome. I use it almost daily to run thru new policy testing.

  4. Alam says

    Definitely, It’s always in Postmaster toolbox 🙂

  5. Joel Beckham says

    This looks awesome. Thanks for the recommendation.

Comment:

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.