- --pipe
- This option takes as its argument a
program and the program's arguments. If this option is present,
swaks opens a pipe to the program and enters an SMTP transaction over that pipe rather than connecting
to a remote server. Some MTAs have testing modes using
stdin/stdout. This option allows you to tie into those options. For
example, if you implemented DNSBL checking
with exim and you wanted to make sure it was working, you could run
'swaks --pipe ``exim -bh 127.0.0.2'''.
In an ideal world the process you are talking to should behave
exactly like an SMTP server on stdin and
stdout. Any debugging should be sent to stderr, which will be
directed to your terminal. In the real world swaks can generally
handle some debug on the child's stdout, but there are no
guarantees on how much it can handle.
- --socket
- This option takes as its argument a unix
domain socket file. If this option is present, swaks enters an
SMTP transaction over over the unix domains
socket rather than over an internet domain socket. I think this
option has uses when combined with a (yet unwritten) LMTP mode, but to be honest at this point I just
implemented it because I could.
- -l, --input-file
- Argument to -l must be a path to a file
containing TOKEN->VALUE pairs. The TOKEN and
VALUE must be separated by whitespace. These
tokens set values which would otherwise be set by command line
arguments. See the description of the corresponding command line
argument for details of each token. Valid tokens are FROM (-f), TO (-t), SERVER (-s), DATA (-d),
HELO (-h), PORT (-p),
INTERFACE (-li), and TIMEOUT (-to).
- -t, --to
- Use argument as ``RCPT TO'' address, or prompt
user if no argument specified. Overridden by -l token TO. Multiple recipients can be specified by supplying
as one comma-delimited argument.
There is no default for this option. If no to addess is
specified with -t or TO token, user will be
prompted for To: address on STDIN.
- -f, --from
- Use argument as ``MAIL FROM'' address, or prompt
user if no argument specified. Overridden by -l token FROM. If no from address is specified, default is
user@host, where user is the best
guess at user currently running program, and host is best guess at
DNS hostname of local host. The string
<> can be supplied to mean the null sender.
- -s, --server
- Use argument as mail server to which to
connect, or prompt user if no argument specified. Overridden by -l
token SERVER. If unspecified, swaks tries to
determine primary MX of destination address.
If Net::DNS module is not available, tries to connect to A record
for recipient's domain.
- -p, --port
- Use argument as port to connect to on
server, or prompt user if no argument is specified. Overridden by
-l token PORT. If unspecified, swaks will
try to connect to port 25.
- -h, --helo, --ehlo
- Use argument as argument to SMTP EHLO/HELO command, or
prompt use if no argument is specified. Overridden by -l token
HELO. If unspecified, swaks uses best guess
at DNS hostname of local host.
- -d, --data
- Use argument as DATA portion of SMTP
transaction, or prompt user if no argument specified. Overridden by
-l token DATA.
This string should be on one single line, with a literal \n
representing where line breaks should be placed. Leading dots will
be quoted. Closing dot is not required but is allowed. Very basic
token parsing is done. %F is replaced with the value that
will be used for ``MAIL FROM'', %T is replaced with ``RCPT TO'' values, %D is
replaced with a timestamp, %H is replaced with the
contents of --add-header, and %B is replaced with the
message body. See the --body option for the default body text.
Default value for this option is ``Date: %D\nTo:
%T\nFrom: %F\nSubject: test
%D\nX-Mailer: swaks v$p_version
jetmore.org/john/code/#swaks\n%H\n\n%B\n''.
- --body
- Specify the body of the email. The default
is ``This is a test mailing''. If no argument to --body, you will
be prompted to supply one. If '-' is supplied, body will be read
from standard input. If any other text is provided and the text
represents an openable file, the content of that file is used as
the body. If it does not respresent an openable file, the text
itself is used as the body.
- --attach
- When one or more --attach option is
supplied, the message is changed into a multipart/mixed MIME message. The arguments to --attach are processed
the same as --body with regard to stdin, file contents, etc.
--attach can be supplie multiple times to create multiple
attachments. By default each attachment is attached as a
application/octet-stream file. See --attach-type for changing this
behaviour.
When the message changes to MIME format,
the previous body (%B) is attached as a text/plain type as the
first attachment. --body can still be used to specify the contents
of this body attachment.
It is legal for '-' (STDIN) to be
specified as an argument multiple times (once for --body and
multiple times for --attach). In this case, the same content will
be attached each time it is specified. This is useful for attaching
the same content with multiple MIME types.
- --attach-type
- By default, content that gets MIME attached to a message with the --attach option is
encoded as application/octet-stream. --attach-type changes the mime
type for every --attach option which follows it. It can be
specified multiple times.
- -ah, --add-header
- In the strictest sense, all this does is
provide a value that replaces the %H token in the data.
Because of where %H is located in the default DATA, practically it is used to add custom headers
without having to recraft the entire body.
The option can either be specified multiple times or a single
time with multiple headers seperated by a literal '\n' string. So,
``--add-header 'Foo: bar' --add-header 'Baz: foo''' and
``--add-header 'Foo: bar\nBaz: foo''' end up adding the same two
headers.
- --timeout
- Use argument as the SMTP transaction timeout, or prompt user if no argument
given. Overridden by the -l token TIMEOUT.
Argument can either be a pure digit, which will be interpretted as
seconds, or can have a specifier s or m (5s = 5 seconds, 3m = 180
seconds). As a special case, 0 means don't timeout the
transactions. Default value is 30s.
- -li, --local-interface
- Use argument as the local interface for
the SMTP connection, or prompt user if no
argument given. Overridden by the -l token INTERFACE. Argument can be an IP
or a hostname. Default action is to let OS
choose local interface.
- -g
- If specified, swaks will read the
DATA value for the mail from STDIN. If there is a From_ line in the email, it will
be removed (but see -nsf option). Useful for delivering real
message (stored in files) instead of using example messages.
- -nsf, --no-strip-from
- Don't strip the From_ line from the
DATA portion, if present.
- -n, --suppress-data
- If this option is specified, swaks
summarizes the DATA portion of the
SMTP transaction instead of printing every
line.
- -q, --quit-after
- The argument to this option is used as an
indicator of where to quit the SMTP
transaction. It can be thought of as ``quit after'', with valid
arguments CONNECT, FISRT-HELO, TLS, HELO, AUTH, MAIL, and RCPT. In a
non-STARTTLS session, FIRST-HELO and HELO
behave the same way. In a STARTTLS session,
FIRST-HELO quits after the first HELO sent,
while HELO quits after the second
HELO is sent.
- -m
- Emulate Mail command. Least used option in
swaks.
- --support
- Cause swaks to print its capabilities and
exit. Certain features require non-standard perl modules. This
options evaluates whether these modules are present and lets you
know which functionality is present.
- -S, --silent
- Cause swaks to be silent. ``-S'' causes
swaks to print no output until an error occurs, after which all
output is shown. ``-S -S'' causes swaks to only show error
conditions. ``-S -S -S'' shows no output.
- --pipeline
- If the remote server supports it, attempt
SMTP PIPELINING
(RFC 2920). This is a younger option, if you
experience problems with it please notify the author. Potential
problem areas include servers accepting DATA
even though there were no valid recipients (swaks should send empty
body in that case, not QUIT) and deadlocks
caused by sending packets outside the tcp window size.
- -tls
- Require connection to use STARTTLS. Exit if TLS not
available for any reason (not advertised, negotiations failed,
etc).
- -tlso, --tls-optional
- Attempt to use STARTTLS if possible, continue t/ normal transaction if
TLS unavailable.
- -tlsc, --tls-on-connect
- Initiate a TLS
connection immediately on connection. Use to test smtps/ssmtp
servers. If this options is specified, the default port changes
from 25 to 465, though this can still be overridden with the -p
option.
- -a, --auth
- Require authentication. If Authentication
fails or is unavailable, stop transaction. -a can take an argument
specifying which type(s) of authentication to try. If multiple,
comma-delimited arguments are given, each specified auth type is
tried in order until one succeeds or they all fail. swaks currently
supports PLAIN, LOGIN, and CRAM-MD5. If no
argument is given any available authentication type is used. If
neither password (-ap) or username (-au) is supplied on command
line, swaks will prompt on STDIN.
SPA (NTLM/MSN)
authentication is now supported. Tested as a client against Exim
and Stalker's CommuniGate, but implementation may be incomplete.
Authen::NTLM is currently required. Note that CPAN hosts two different Authen::NTLM modules. Current
implementation requires Mark Bush's implementation
(Authen/NTLM-1.02.tar.gz). Plan to reimplement directly at some
point to avoid confusion.
DIGEST-MD5 is now supported. Tested as a
client only against Stalker's Communigate, so implementation may be
incomplete. Requires Authen::DigestMD5 module.
CRAM-SHA1 is now supported. Only tested
against a hacked server implementation in Exim, so may be
incomplete or incorrect. Requires Digest::SHA1 module.
- -ao, --auth-optional
- Same as -a, but if authentication is
unavailable or fails, attempts to continue transaction.
- -au, --auth-user
- Supply the username for authentication.
The string <> can be supplied to mean an empty username.
For SPA authentication, a ``domain'' can
be specified after the regular username with a % seperator. For
instance, if ``-ap user@example.com%NTDOM'' is passed,
``user@example.com'' is the
username and ``NTDOM'' is the domain.
NOTE: I don't actually have access to a mail
server where the domain isn't ignored, so this may be implemented
incorrectly.
- -ap, --auth-password
- Supply the password for authentication.
The string <> can be supplied to mean an empty password.
- -am --auth-map
- Provides a way to map alternate names onto
base authentication types. Useful for any sites that use alternate
names for common types. This functionality is actually used
internally to map types SPA and MSN onto the base type NTLM. The
command line argument to simulate this would be ``--auth-map
SPA=NTLM,MSN=NTLM''. The base types supported are LOGIN, PLAIN, CRAM-MD5, DIGEST-MD5, and
NTLM. SPA and
MSN are mapped on to NTLM automatically.
- -apt, --auth-plaintext
- Instead of showing AUTH strings literally (in base64), translate them to
plaintext before printing on screen.
- -nth, --no-hints
- Don't show transaction hints. (Useful in
conjunction with -hr to create copy/paste-able transactions
- -hr, --hide-receive
- Don't display reception lines
- -hs, --hide-send
- Don't display sending lines
- -stl, --show-time-lapse
- Display time lapse between send/receive
pairs. If 'i' is provided as argument or the Time::HiRes module is
unavailable the time lapse will be integer only, otherwise it will
be to the thousandth of a second.
- --force-getpwuid
- In releases 20050709.1 and earlier of
swaks the local_part of an automatically generated sender email
address would be found using the getpwuid system call on the euid
of the current process. Depending on the users' desires, this may
be confusing. Following the 20050709.1 release the local_part is
not looked up via the getlogin() funtion which attempts to
look up the actual username of the logged in user, regardless of
the euid of the process they are currently running.
An example of where this might be an issue is running swaks
under sudo for testing reasons when interacting with --pipe or
--socket. It makes sense that you need to run the process as a
specific username but you would prefer your email to be from your
real username. You could always do this manually using the -s
option, but this is an attempt to make it easier.
--force-getpwuid forces the old behaviour for anyone who
prefered that behaviour. Also, if there is no ``real'' user for
getlogin() to look up, the old getpwuid method will be used.
This would happen if the process was run from cron or some other
headless daemon.
- --help
- This screen.
- --version
- Version info.