swaks (Swiss Army Knife SMTP) is a command-line tool designed to test SMTP (Simple Mail Transfer Protocol) transactions. It is a versatile and flexible tool that can be used to test and troubleshoot email delivery issues, as well as to perform load testing of SMTP servers.
Some of the features of swaks include:
- Sending test emails: swaks can send test emails to specified recipients, allowing users to verify that email delivery is functioning correctly.
- SMTP protocol testing: swaks can simulate various SMTP protocol scenarios, such as sending emails with different header values, testing authentication and encryption settings, and verifying the delivery of messages.
- Load testing: swaks can simulate multiple email transactions simultaneously, making it useful for load testing SMTP servers.
- Extensibility: swaks is designed to be easily extensible, with plugins available to support additional features and protocols.
swaks Command Examples
1. Deliver a standard test email to `user@example.com` on port 25 of `test-server.example.net`:
# swaks --to user@example.com --server test-server.example.net
2. Deliver a standard test email, requiring CRAM-MD5 authentication as user `me@example.com`. An “X-Test” header will be added to the email body:
# swaks --to user@example.com --from me@example.com --auth CRAM-MD5 --auth-user me@example.com --header-X-Test "test_email"
3. Test a virus scanner using EICAR in an attachment. Don’t show the message DATA part:
# swaks -t user@example.com --attach - --server test-server.example.com --suppress-data path/to/eicar.txt
4. Test a spam scanner using GTUBE in the body of an email, routed via the MX records for `example.com`:
# swaks --to user@example.com --body path/to/gtube_file
5. Deliver a standard test email to `user@example.com` using the LMTP protocol via a UNIX domain socket file:
# swaks --to user@example.com --socket /var/lda.sock --protocol LMTP
Summary
swaks is a Perl script and can be installed on most Linux systems using package managers such as apt or yum. The tool provides a wide range of configuration options that allow users to customize the behavior of SMTP transactions. The command syntax of swaks is straightforward, and the tool generates detailed output, making it easy to diagnose and troubleshoot issues.
In summary, swaks is a powerful tool for testing and troubleshooting SMTP transactions. Its versatility, extensibility, and detailed output make it a valuable addition to any email administrator or developer’s toolkit.