Do you even Swaks, bro?

Do you know about Swaks? Maybe not! It is perhaps not very widely known, but it is an amazingly useful tool. Swaks, created and maintained by John Jetmore, is billed as a "Swiss Army Knife for SMTP" and that's an apt description.

What is it? It's an SMTP testing utility. It lets you watch as it connects to a remote mail server and attempts to send an email message using the values you specify. You can specify the sender, recipient, and which server to connect to. You can also specify body content, if you want, though it has a good default "this is a test" setting.

I use it to test things like:

  • Is a domain's mail server properly configured to accept mail for that domain?
  • For a domain with multiple MX (mail) servers, do all of them properly accept mail for that domain?
  • Does a certain mail server relay mail for everyone, when it shouldn't? (Remember open relays?)
  • Double check to see if a blocking issue is still happening, confirming whether or not that issue is intermittent or ongoing.
  • How long does it take after message handoff for an email to land in the inbox? (When I start with SWAKS, I can visually observe that SMTP handoff.)

Smart email administrators can do other useful things with this tool, too (check the man page). Test authentication settings, do a virus check test with a GTUBE file, and more. I used it just yesterday to test and see if the IP addresses in the A records listed for "yahoo.co" answer on port 25. (They do not; mail to yahoo.co goes nowhere.)

Like with anything that speaks SMTP, though, you'll want to be a bit careful and not rig up a script to tickle an ISP's mail server hundreds or thousands of times. Doing something "funny" (like trying to use this script to mass validate email addresses) is going to get you blocked or cause other problems, and it won't be the fault of the script!

No comments:

Post a Comment

Comments policy: Al is always right. Kidding, mostly. Be polite, and you're welcome to join in, even if it's a differing viewpoint.