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 `firstname.lastname@example.org` on port 25 of `test-server.example.net`:
# swaks --to email@example.com --server test-server.example.net
2. Deliver a standard test email, requiring CRAM-MD5 authentication as user `firstname.lastname@example.org`. An “X-Test” header will be added to the email body:
# swaks --to email@example.com --from firstname.lastname@example.org --auth CRAM-MD5 --auth-user email@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 firstname.lastname@example.org --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 email@example.com --body path/to/gtube_file
5. Deliver a standard test email to `firstname.lastname@example.org` using the LMTP protocol via a UNIX domain socket file:
# swaks --to email@example.com --socket /var/lda.sock --protocol LMTP
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.