swaks - Swiss Army Knife SMTP, the all-purpose smtp transaction tester

Posted . Visible to the public.

swaks Show archive.org snapshot is a very nice tool to test SMTP. For the most linux distributions you can easily install it with your package management system.

This example send an email from from@example.com to to@example.com via the server mail23.example.com with the user from@example.com and password mysupersecurepasswordyouneverget for authentication and require the connection to use STARTTLS.

$ swaks -tls --to to@example.com --from from@example.com --auth-user from@example.com  --server mail23.example.com
Password: mysupersecurepasswordyouneverget
=== Trying mail23.example.com:25...
=== Connected to mail23.example.com.
<-  220 mail23.example.com ESMTP Exim 4.76 Mon, 04 Nov 2013 15:56:21 +0100
 -> EHLO crabman.lan
<-  250-mail23.example.com Hello crabman.lan [127.0.0.1]
<-  250-SIZE 52428800
<-  250-PIPELINING
<-  250-AUTH LOGIN PLAIN
<-  250-STARTTLS
<-  250 HELP
 -> STARTTLS
<-  220 TLS go ahead
=== TLS started w/ cipher DHE-RSA-AES256-SHA
=== TLS peer subject DN="/C=DE/OU=Domain Control Validated/CN=mail23.example.com"
 ~> EHLO crabman.lan
<~  250-mail23.example.com Hello crabman.lan [127.0.0.1]
<~  250-SIZE 52428800
<~  250-PIPELINING
<~  250-AUTH LOGIN PLAIN
<~  250 HELP
 ~> AUTH LOGIN
<~  334 VXOlcm5hgWU6
 ~> ZGlrdGi0b3JAa7ltYm9kh2NoYS5kZQ==
<~  334 UEFzc2dvcmP6
 ~> Zm2vTnFy
<~  235 Authentication succeeded
 ~> MAIL FROM:<from@example.com>
<~  250 OK
 ~> RCPT TO:<to@example.com>
<~  250 Accepted
 ~> DATA
<~  354 Enter message, ending with "." on a line by itself
 ~> Date: Mon, 04 Nov 2013 15:56:19 +0100
 ~> To: to@example.com
 ~> From: from@example.com
 ~> Subject: test Mon, 04 Nov 2013 15:56:19 +0100
 ~> X-Mailer: swaks v20111230.0 jetmore.org/john/code/swaks/
 ~>
 ~> This is a test mailing
 ~>
 ~> .
<~  250 OK id=1VdLZm-0004D7-HZ
 ~> QUIT
<~  221 mail23.example.com closing connection
=== Connection closed with remote host.
Last edit
License
Source code in this card is licensed under the MIT License.