swaks – Swiff army nife for SMTP

If you are having issues with the SMTP Server, then sometimes you just wish you had a swiss army knife to test the same and then you would not have to spend your precious time on some silly mistake that you may have made. Your wish is now fulfilled.

Swiss Army Knife SMTP: A command line SMTP tester.  Swaks can test various aspects of your SMTP server, including TLS and AUTH.

swaks can be easily installed with :

sudo yum install swaks

To begin with, if you want to test the localhost then simply enter swaks, you will be asked for \”to\” address. And then there will be a attempt to send the mail. And you can see the messages on the console. Here\’s an example:

To: =========================
=== Trying localhost:25…
=== Connected to ===============.
<-  220 amit.themafia.info ESMTP Exim 4.69 Sun, 07 Mar 2010 10:24:25 +0530
-> EHLO amit.themafia.info
<-  250-amit.themafia.info Hello
======================
<-  250-SIZE 52428800
<-  250-PIPELINING
<-  250-STARTTLS
<-  250 HELP
-> MAIL FROM
:===========================
<-  250 OK
-> RCPT TO
:================
<-  250 Accepted
-> DATA
<-  354 Enter message, ending with \”.\” on a line by itself
-> Date: Sun, 07 Mar 2010 10:24:25 +0550
-> To:=====================
-> From: ===================================
-> Subject: test Sun, 07 Mar 2010 10:24:25 +0550
-> X-Mailer: swaks v20061116.0 jetmore.org/john/code/#swaks
->
-> This is a test mailing
->
-> .
<-  250 OK id=1No8VV-0003bT-EC
-> QUIT
<-  221 amit.themafia.info closing connection
=== Connection closed with remote host.

For my own security, I have removed my email address and other things. Now, coming to other things.

Here are few of the options that you may find useful

-s ==> server

-f ==> from

-t ==> to

-l ==> input file

-d ==> data

–attach

-h ==> header

–protocol

HELO            AUTH    TLS     PORT
————————————————–
SMTP    HELO                            smtp  / 25
SSMTP   EHLO->HELO              -tlsc   smtps / 465
SSMTPA  EHLO->HELO      -a      -tlsc   smtps / 465
SMTPS   HELO                    -tlsc   smtps / 465
ESMTP   EHLO->HELO                      smtp  / 25
ESMTPA  EHLO->HELO      -a              smtp  / 25
ESMTPS  EHLO->HELO              -tls    smtp  / 25
ESMTPSA EHLO->HELO      -a      -tls    smtp  / 25
LMTP    LHLO                            lmtp  / 24
LMTPA   LHLO            -a              lmtp  / 24
LMTPS   LHLO                    -tls    lmtp  / 24
LMTPSA  LHLO            -a      -tls    lmtp  / 24

You can check other options in the man page or the help.

\"Reblog