swaks – Swiff army nife for SMTP

2010-03-09 3 min read Fedora Learning Linux

If you are having issues with the <a class="zem_slink freebase/en/simple_mail_transfer_protocol" title="Simple Mail Transfer Protocol" rel="wikipedia" href="http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol">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.

<a class="zem_slink freebase/en/military_of_switzerland" title="Military of Switzerland" rel="wikipedia" href="http://en.wikipedia.org/wiki/Military_of_Switzerland">Swiss Army Knife SMTP: A <a class="zem_slink freebase/en/command_line_interface" title="Command-line interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Command-line_interface">command line SMTP tester.  Swaks can test various aspects of your SMTP <a class="zem_slink freebase/en/server" title="Server (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Server_%28computing%29">server, including <a class="zem_slink freebase/en/transport_layer_security" title="Transport Layer Security" rel="wikipedia" href="http://en.wikipedia.org/wiki/Transport_Layer_Security">TLS and AUTH.

swaks can be easily installed with :

<a class="zem_slink freebase/en/sudo" title="Sudo" rel="homepage" href="http://www.sudo.ws/">sudo yum install swaks

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

<span style="color: #ff00ff;">To: =========================
=== Trying localhost:25…
=== Connected to ===============.
<-  220 amit.themafia.info <a class="zem_slink freebase/en/extended_smtp" title="Extended SMTP" rel="wikipedia" href="http://en.wikipedia.org/wiki/Extended_SMTP">ESMTP <a class="zem_slink freebase/en/exim" title="Exim" rel="homepage" href="http://www.exim.org/">Exim 4.69 <a class="zem_slink freebase/en/sun" title="Sun" rel="wikipedia" href="http://en.wikipedia.org/wiki/Sun">Sun, 07 Mar 2010 10:24:25 +0530
-> EHLO amit.themafia.info
<-  250-amit.themafia.info Hello ======================
<span style="color: #ff00ff;"><-  250-SIZE 52428800
<-  250-PIPELINING
<-  250-STARTTLS
<-  250 HELP
-> <a class="zem_slink freebase/en/bounce_address" title="Bounce address" rel="wikipedia" href="http://en.wikipedia.org/wiki/Bounce_address">MAIL FROM:===========================
<span style="color: #ff00ff;"><-  250 OK
-> RCPT TO:================
<span style="color: #ff00ff;"><-  250 Accepted
-> DATA
<-  354 Enter message, ending with &#8221;.&#8221; 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.

<span style="color: #ff00ff;"><span style="color: #000000;">For my own security, I have removed my email address and other things. Now, coming to other things.

<span style="color: #ff00ff;"><span style="color: #000000;">Here are few of the options that you may find useful

<span style="color: #ff00ff;"><span style="color: #000000;">-s ==> server

<span style="color: #ff00ff;"><span style="color: #000000;">-f ==> from

<span style="color: #ff00ff;"><span style="color: #000000;">-t ==> to

<span style="color: #ff00ff;"><span style="color: #000000;">-l ==> input file

<span style="color: #ff00ff;"><span style="color: #000000;">-d ==> data

<span style="color: #ff00ff;"><span style="color: #000000;">–attach

<span style="color: #ff00ff;"><span style="color: #000000;">-h ==> header

<span style="color: #ff00ff;"><span style="color: #000000;">–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.<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/bcedc618-c4b2-493a-83f5-0355c1376145/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b2.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

comments powered by Disqus