Swaks – Swiss Army Knife for SMTP

By | Command Line, Linux

Swaks is an epic command line e-mailer. I love me some command line e-mail action satisfaction! See below for details.


  • Ubuntu: sudo apt-get install -y swaks
  • CentOS: yum install swaks
  • HomeBrew: brew install swaks


To invoke the program use the syntax below:

swaks --to '<SEND-EMAIL>' --from '<FROM-EMAIL>' --server <SERVER> --auth LOGIN --auth-user '<USER-NAME>' --auth-password '<PASSWORD>' --header 'Subject: <SUBJECT>' --body '<BODY>'


  • ––to = recipient
  • ––from = address you want to appear as from
  • ––server = SMTP server you want to use to send mail
  • ––auth = authentication type
  • ––auth-user = username used for SMTP authentication
  • ––auth-password = password for SMTP authentication
  • ––header = header part including Subject
  • ––body = Text you want to appear in the mail boxy. You can create a text file and use that instead (–body file.txt)

Other Parameters

  • ––attach-type = attachment mime type, can be repeated as needed
  • ––attach = mail attachment, can be repeated as needed
  • ––port = SMTP server port, I use 587 (submission)
  • ––timeout = timeout in seconds/minutes is there is delay in SMTP communication as in case of fight against spam
  • ––tls = tells swaks to STATTLS

For more swaks goodness check out this article.

Leave a Reply

Your email address will not be published. Required fields are marked *