Help Docs Email Using Swaks to Troubleshoot Email Issues on Your Server

Using Swaks to Troubleshoot Email Issues on Your Server

Use Swaks to test SMTP, auth, and email delivery issues from your server with detailed output for fast email troubleshooting.

When email delivery issues arise on your Liquid Web server, pinpointing the root cause is essential. One of the most powerful tools available for email testing is Swaks (Swiss Army Knife for SMTP). This command-line utility allows for detailed and customizable SMTP transactions, helping you quickly identify problems in sending or relaying mail.

This guide explains how to install and use Swaks to troubleshoot common email issues.


What Is Swaks?

Swaks is a versatile, scriptable, and highly configurable testing tool for SMTP servers. It allows administrators to simulate sending email using various SMTP configurations, such as:

  • Specific sender and recipient addresses
  • Custom SMTP ports
  • Authentication credentials
  • TLS/SSL encryption

Swaks is ideal for identifying where an email delivery failure is occurring—whether it’s DNS resolution, SMTP authentication, relaying issues, or message rejection by the destination server.


Installing Swaks

Swaks is available through package managers on most Linux distributions.

On CentOS / RHEL:

yum install epel-release
yum install swaks

On Ubuntu / Debian:

apt update
apt install swaks

Common Swaks Use Cases

Here are typical ways Swaks can be used to test email functionality:

1. Basic SMTP Test (No Authentication)

This sends a simple email from your server to check if SMTP communication is working:

swaks --to recipient@example.com --from sender@example.com --server mail.example.com

2. SMTP Authentication Test

Test sending with SMTP authentication (replace values as appropriate):

swaks --to recipient@example.com --from sender@example.com 
--server mail.example.com --auth LOGIN 
--auth-user username --auth-password password

3. Testing Specific Port or Encryption

To test using port 587 with STARTTLS:

swaks --to recipient@example.com --from sender@example.com 
--server mail.example.com --port 587 --tls

To test SMTPS on port 465:

swaks --to recipient@example.com --from sender@example.com 
--server mail.example.com --port 465 --smtps

Troubleshooting Tips with Swaks

Swaks provides detailed feedback for each step of the SMTP session. When troubleshooting, pay attention to:

  • DNS resolution errors: May indicate incorrect MX or A records.
  • Authentication failures: Can indicate incorrect credentials or disabled SMTP auth.
  • Relay denied messages: Suggest the server is not configured to relay for your IP.
  • Rejection by destination server: Look for clues in the SMTP error response.

Example output snippet:

<** 550 5.1.1 <recipient@example.com>: Recipient address rejected: User unknown**

This indicates that the recipient address doesn’t exist on the destination mail server.


Summary

Swaks is a powerful email diagnostics tool that every server admin should have in their toolkit. By simulating real-world email sends, it allows for effective testing of your SMTP server, authentication configuration, and mail delivery paths.

For persistent issues or assistance interpreting Swaks output, reach out to Liquid Web Support

Was this article helpful?