swaks

From RaySoft

swaks' primary design goal is to be a flexible, scriptable, transaction-oriented SMTP test tool. It handles SMTP features and extensions such as TLS, authentication, and pipelining; multiple version of the SMTP protocol including SMTP, ESMTP, and LMTP; and multiple transport methods including UNIX-domain sockets, internet-domain sockets, and pipes to spawned processes. Options can be specified in environment variables, configuration files, and the command line allowing maximum configurability and ease of use for operators and scripters.[1]

Documentation

Syntax

swaks [PARAMETER ...]

Parameters

Protocol

-f [ADDRESS], --from [ADDRESS]
Use argument as envelope-sender for email, or prompt user if no argument specified.
-t [ADDRESS,...], --to [ADDRESS,...]
Tells swaks to use argument(s) as the envelope-recipient for the email, or prompt for recipient if no argument provided. If multiple recipients are provided and the recipient domain is needed to determine routing the domain of the last recipient provided is used.

TLS / Encrytion

-tls
Require connection to use STARTTLS. Exit if TLS not available for any reason (not advertised, negotiations failed, etc).
--tls-verify
Tell swaks to attempt to verify the server's certificate.

Authentication

-a [TYPE,...], --auth [TYPE,...]
Require swaks to authenticate. If no argument is given, any supported auth-types advertised by the server are tried until one succeeds or all fail.

Data

--header HEADER: DATA
These options allow a way to change headers that already exist in the DATA.

Examples

Send an email using Gmail
swaks --server 'smtp.gmail.com:587' -tls --auth 'LOGIN' \
  --from 'alex.the.lion@gmail.com' --to 'marty.the.zebra@gmail.com' \
  --header 'From: Alex the Lion <alex.the.lion@gmail.com>' \
  --header 'To: Marty the Zebra <marty.the.zebra@gmail.com>' \
  --header 'Subject: Melman loves Gloria...!'

References

  1. man 1 'swaks'