swaks
Swiss Army Knife for SMTP testing
TLDR
Send test email to a server
SYNOPSIS
swaks [OPTIONS]
DESCRIPTION
swaks (Swiss Army Knife SMTP) is a comprehensive SMTP testing tool for diagnosing mail server configurations, testing authentication, and verifying email delivery. It supports SMTP, ESMTP, and LMTP protocols over various transports including TCP sockets, UNIX sockets, and TLS connections.
The tool is invaluable for testing spam filters (using GTUBE), virus scanners (using EICAR), authentication mechanisms, and TLS configurations. It provides detailed transaction logging for troubleshooting.
PARAMETERS
-t, --to address
Recipient email address-f, --from address
Sender email address-s, --server host
SMTP server hostname or IP-p, --port port
SMTP port (default: 25)-a, --auth type
Authentication type (PLAIN, LOGIN, CRAM-MD5, etc.)-au, --auth-user user
Authentication username-ap, --auth-password pass
Authentication password--tls
Use STARTTLS--tlsc
Use implicit TLS (SMTPS)--socket path
Connect via UNIX domain socket--protocol proto
Protocol: SMTP, ESMTP, LMTP--attach file
Attach file to message--body file
Use file as message body--header-_Name_ value
Add custom header-n, --suppress-data
Don't show DATA portion-q, --quiet
Minimize output--timeout seconds
Connection timeout
CAVEATS
Requires Perl. Passwords on command line are visible in process listings; use config files for sensitive data. Some authentication methods require additional Perl modules. Test emails may trigger spam filters.
HISTORY
swaks was created by John Jetmore and has been actively maintained since the early 2000s. It has become a standard tool for mail server administrators and is available in most Linux distribution repositories. The tool is written in Perl and released under GPLv2.
