Installation
swaks (the “Swiss Army Knife for SMTP”) is a single Perl script and ships in every common package repository:
TLS additionally needs Net::SSLeay (perl-Net-SSLeay or libnet-ssleay-perl). swaks --support shows what your installation can do — if “TLS supported” is missing, every test with --tls fails.
Reading the output
swaks logs the entire dialogue. The characters at the start of each line tell you who is speaking:
Once the arrows turn into tildes after STARTTLS, the connection is encrypted.
First test: accept without sending
With --quit-after RCPT swaks stops after the recipient. The server says whether it would take the mail — but nothing is delivered:
--helo almost always belongs there: without it swaks often cannot determine its own hostname and aborts with Helo string required. And many receivers reject a HELO that is not a fully qualified hostname.
If you leave out --server, swaks looks up the recipient domain's MX itself. Outbound port 25 is blocked on many residential and mobile connections — the attempt then ends in a timeout, and the test belongs on a server.
Checking STARTTLS and the certificate
--tlsrequires STARTTLS and aborts if the server does not offer it.--tls-optionalmerely tries.--tls-verifychecks chain and hostname (swaks 20240103 and later). On success it reportspassed CA verification, passed host verification.--tls-get-peer-certadditionally prints the server certificate as PEM.--tls-protocol tlsv1_2forces a specific version — a way to check whether the server still accepts it.
The line TLS started with cipher TLSv1.3:TLS_AES_256_GCM_SHA384:256 names version, cipher suite and key strength; below it the chain follows as TLS peer[0], peer[1] … with subject, SAN and expiry date.
Submission with login (ports 587 and 465)
Port 587 starts in plaintext and upgrades via STARTTLS (--tls); port 465 speaks TLS from the very first second (--tls-on-connect). Mixing them up gets you a timeout or 530 Must issue a STARTTLS command first.
Without --auth-password swaks prompts for the password — so it never lands in your shell history. --auth-hide-password masks it in the output too: otherwise the AUTH line contains it Base64-encoded, which is plaintext for anyone you show the log to. A failed login shows up as 535 5.7.8 Authentication credentials invalid.
Is the server an open relay?
A mail server may only accept mail for foreign domains from authenticated users. The test: foreign sender, foreign recipient, no login.
A 250 at this point means anyone on the internet can send spam through the server, and the next blacklist listing is a matter of hours. What the rejection normally means is covered under 554 5.7.1 Relay access denied.
Does the recipient exist?
The same setup with a real domain but an invented mailbox:
A properly configured server rejects here with 550 5.1.1 User unknown. If it accepts, it later sends a bounce to a sender who never sent the mail — backscatter, and a reason for listings.
A real test mail with subject, body and attachment
--h-Subjectsets a header; any other works the same way (--h-Reply-To) or via--add-header "X-Test: 1".- An
@in front of a filename reads the content from that file — for--attachas well as--body. --dump-mailshows the finished message beforehand without sending it.
Sending the test mail to AnalyzeMy.Email
Send the test mail to hello@analyzemy.email — through your real outbound server, i.e. with --server, port 587 and login as above. The reply covers SPF, DKIM, DMARC, the TLS path and blacklist status. Sent straight from a laptop to our MX, SPF fails by necessity: the report then examines your laptop, not your mail server.