table of contents
other sections
conflicting packages
MSMTP(1) | General Commands Manual | MSMTP(1) |
NAME¶
msmtp - An SMTP clientSYNOPSIS¶
- Sendmail mode (default):
- msmtp [option...] [--] recipient...
- Server information mode:
- msmtp [option...] --serverinfo
- Remote Message Queue Starting mode:
- msmtp [option...] --rmqs= host|@domain| #queue
DESCRIPTION¶
In the default sendmail mode, msmtp reads a mail from standard input and sends it to an SMTP server for delivery.EXIT STATUS¶
The standard sendmail exit status codes are used, as defined in sysexits.h.OPTIONS¶
Options override configuration file settings.- General options
- --version
- Print version information. This includes information about the library used for TLS/SSL support (if any), the library used for authentication, the authentication mechanisms supported by this library, and the default locations of the system and user configuration files.
- --help
- Print help.
- -P, --pretend
- Print the configuration settings that would be used, but do not take further action. An asterisk (`*') will be printed instead of your password.
- -v, -d, --debug
- Print lots of debugging information, including the whole conversation with the SMTP server. Be careful with this option: the (potentially dangerous) output will not be sanitized, and your password may get printed in an easily decodable format!
- Changing the mode of operation
- -S, --serverinfo
- Print information about the SMTP server and exit. This includes information about supported features (mail size limit, authentication, TLS, DSN, ...) and about the TLS certificate (if TLS is active).
- --rmqs=(host|@domain|#queue)
- Send a Remote Message Queue Starting request for the given host, domain, or queue to the SMTP server and exit.
- Configuration options
- -C, --file=filename
- Use the given file instead of ~/.msmtprc as the user configuration file.
- -a, --account=account_name
- Use the given account instead of the account named "default". The settings of this account may be changed with command line options. This option cannot be used together with the --host option.
- --host=hostname
- Use this SMTP server with settings from the command line; do not use any configuration file data. This option cannot be used together with the --account option.
- --port=number
- Set the port number to connect to. See the port command below.
- --timeout=(off|seconds)
- Set a network timeout. See the timeout command below. For compatibility with older versions, --connect-timeout is accepted as an alias for this option.
- --protocol=(smtp|lmtp)
- Set the protocol to use. See the protocol command below.
- --auth[=(on|off|method)]
- Enable or disable authentication. You can optionally choose the method. See the auth command below.
- --user=[username]
- Set or unset the user name for authentication. See the user command below.
- --passwordeval=[eval]
- Set your password for SMTP authentication to the output (stdout) of the execution of eval.
- --tls[=(on|off)]
- Enable or disable TLS/SSL encryption. See the tls command below.
- --tls-starttls[=(on|off)]
- Enable or disable STARTTLS for TLS encryption. See the tls_starttls command below.
- --tls-trust-file=[file]
- Set or unset a trust file for TLS encryption. See the tls_trust_file command below.
- --tls-crl-file=[file]
- Set or unset a certificate revocation list (CRL) file for TLS. See the tls_crl_file command below.
- --tls-fingerprint=[fingerprint]
- Set ot unset the fingerprint of a trusted TLS certificate. See the tls_fingerprint command below.
- --tls-key-file=[file]
- Set or unset a key file for TLS encryption. See the tls_key_file command below.
- --tls-cert-file=[file]
- Set or unset a cert file for TLS encryption. See the tls_cert_file command below.
- --tls-certcheck[=(on|off)]
- Enable or disable server certificate checks for TLS encryption. See the tls_certcheck command below.
- --tls-force-sslv3[=(on|off)]
- Force TLS/SSL version SSLv3. See the tls_force_sslv3 command below.
- --tls-min-dh-prime-bits=[bits]
- Set or unset minimum bit size of the Diffie-Hellman (DH) prime. See the tls_min_dh_prime_bits command below.
- --tls-priorities=[priorities]
- Set or unset TLS priorities. See the tls_priorities command below.
- --domain=[string]
- Set the argument of the SMTP EHLO (or LMTP LHLO) command. See the domain command below.
- Options specific to sendmail mode
- --auto-from[=(on|off)]
- Enable or disable automatic envelope-from addresses. The default is off. See the auto_from command below.
- -f, --from=address
- Set the envelope-from address. It is only used when
auto_from is off.
- --maildomain=[domain]
- Set the domain part for generated envelope-from addresses. It is only used when auto_from is on. See the maildomain command below.
- -N, --dsn-notify=(off|cond)
- Set or unset DSN notification conditions. See the dsn_notify command below.
- -R, --dsn-return=(off|ret)
- Set or unset the DSN notification amount. See the dsn_return command below. Note that hdrs is accepted as an alias for headers to be compatible with sendmail.
- --keepbcc[=(on|off)]
- Enable or disable the preservation of the Bcc header. See the keepbcc command below.
- -X, --logfile=[file]
- Set or unset the log file. See the logfile command below.
- --syslog[=(on|off|facility)]
- Enable or disable syslog logging. See the syslog command below.
- -t, --read-recipients
- Read recipient addresses from the To, Cc, and Bcc headers of the mail in addition to the recipients given on the command line. If any Resent- headers are present, then the addresses from any Resent-To, Resent-Cc, and Resent-Bcc headers in the first block of Resent- headers are used instead.
- --read-envelope-from
- Read the envelope from address from the From header of the mail.
- --aliases=[file]
- Set or unset an aliases file. See the aliases command below.
- --
- This marks the end of options. All following arguments will be treated as recipient addresses, even if they start with a `-'.
USAGE¶
Normally, a system wide configuration file and/or a user configuration file contain information about which SMTP server to use (and how to use it), but almost all settings can also be configured on the command line. Information about SMTP servers is organized in accounts. Each account describes one SMTP server: host name, authentication settings, TLS settings, and so on. Each configuration file can define multiple accounts. In sendmail mode, an envelope-from address is necessary to send mail. This is the mail address that will be presented to the SMTP server as the originator of the mail. Envelope-from addresses can be generated automatically (when auto_from is enabled) or set explicitly with the from command or --from option. When auto_from is enabled, an envelope-from address of the form user@domain will be generated. The local part will be set to USER or, if that fails, to LOGNAME or, if that fails, to the login name of the current user. The domain part can be set with the maildomain command. If the maildomain is empty, the envelope-from address will only consist of the user name and not have a domain part. The user can choose which account to use in one of three ways:- --account=id
- Use the given account. Command line settings override configuration file settings.
- --host=hostname
- Use only the settings from the command line; do not use any configuration file data.
- --from=address or --read-envelope-from
- Choose the first account from the system or user configuration file that has a matching envelope-from address as specified by a from command. This works only when neither --account nor --host is used.
CONFIGURATION FILES¶
If it exists and is readable, a system wide configuration file SYSCONFDIR/msmtprc will be loaded, where SYSCONFDIR depends on your platform. Use --version to find out which directory is used.- defaults
- Set defaults. The following configuration commands will set default values for all following account definitions in the current configuration file.
- account name [:account[,...]]
- Start a new account definition with the given name. The
current default values are filled in.
- host hostname
- The SMTP server to send the mail to. The argument may be a host name or a network address. Every account definition must contain this command.
- port number
- The port that the SMTP server listens on. The default port will be acquired from your operating system's service database: for SMTP, the service is "smtp" (default port 25), unless TLS without STARTTLS is used, in which case it is "ssmtp" (465). For LMTP, it is "lmtp".
- timeout (off|seconds)
- Set or unset a network timeout, in seconds. The argument
off means that no timeout will be set, which means that the
operating system default will be used.
- protocol (smtp|lmtp)
- Set the protocol to use. Currently only SMTP and LMTP are supported. SMTP is the default. See the port command above for default ports.
- auto_from [(on|off)]
- Enable or disable automatic envelope-from addresses. The default is off. When enabled, an envelope-from address of the form user@domain will be generated. The local part will be set to USER or, if that fails, to LOGNAME or, if that fails, to the login name of the current user. The domain part can be set with the maildomain command. If the maildomain is empty, the envelope-from address will only consist of the user name and not have a domain part. When auto_from is disabled, the envelope-from address must be set explicitly.
- from envelope_from
- Set the envelope-from address. This address will only be used when auto_from is off.
- maildomain [domain]
- Set a domain part for the generation of an envelope-from address. This is only used when auto_from is on. The domain may be empty.
- auth [(on|off|method)]
- This command enables or disables SMTP authentication. You
should not need to set the method yourself; with the argument on,
msmtp will choose the best one available for you (see below).
- user [username]
- Set your user name for SMTP authentication. An empty argument unsets the user name. Authentication must be activated with the auth command.
- password [secret]
- Set your password for SMTP authentication. An empty argument unsets the password. Authentication must be activated with the auth command. If no password is set but one is needed during authentication, msmtp will try to find it. First, if passwordeval is set, it will evaluate that command. If passwordeval is not set, msmtp will try to find the password in ~/.netrc. If that fails, it will try to find it in SYSCONFDIR/netrc (use --version to find out what SYSCONFDIR is on your platform). If that fails, it will try to get it from a system specific keychain (if available). If that fails but a controlling terminal is available, msmtp will prompt you for it.
- passwordeval [eval]
- Set your password for SMTP authentication to the output (stdout) of the execution of eval.
- ntlmdomain [domain]
- Set a domain for the ntlm authentication method. The default is to use no domain (equivalent to an empty argument), but some servers seem to require one, even if it is an arbitrary string.
- tls [(on|off)]
- This command enables or disables TLS (also known as SSL)
encrypted connections to the SMTP server. Not every server supports TLS.
- tls_starttls [(on|off)]
- By default, TLS encryption is activated using the STARTTLS
SMTP command. By disabling this, TLS encryption is immediately started
instead (this is known as SMTP tunneled through TLS/SSL). The default port
is set to 465 for this mode of operation.
- tls_trust_file [file]
- This command activates strict server certificate
verification.
- tls_crl_file [file]
- This command sets or unsets a certificate revocation list (CRL) file for TLS, to be used during strict server certificate verification as enabled by the tls_trust_file command. This allows the verification procedure to detect revoked certificates.
- tls_fingerprint [fingerprint]
- This command sets or unsets the fingerprint of a particular
TLS certificate. This certificate will then be trusted, regardless of its
contents. This can be used to trust broken certificates (e.g. with a
non-matching hostname) or in situations where tls_trust_file cannot
be used for some reason.
- tls_key_file [file]
- This command (together with the tls_cert_file command) enables msmtp to send a client certificate to the SMTP server if requested. The file must contain the private key of a certificate in PEM format. An empty argument disables this feature.
- tls_cert_file [file]
- This command (together with the tls_key_file command) enables msmtp to send a client certificate to the SMTP server if requested. The file must contain a certificate in PEM format. An empty argument disables this feature.
- tls_certcheck [(on|off)]
- This command enables or disables checks for the server
certificate.
- tls_force_sslv3 [(on|off)]
- Force TLS/SSL version SSLv3. This might be needed to use SSL with some old and broken servers. Do not use this unless you have to.
- tls_min_dh_prime_bits [bits]
- Set or unset the minimum number of Diffie-Hellman (DH) prime bits that msmtp will accept for TLS sessions. The default is set by the TLS library and can be selected by using an empty argument to this command. Only lower the default (for example to 512 bits) if there is no other way to make TLS work with the remote server.
- tls_priorities [priorities]
- Set the priorities for TLS sessions. The default is set by the TLS library and can be selected by using an empty argument to this command. Currently this command only works with sufficiently recent GnuTLS releases. See the GnuTLS documentation of the gnutls_priority_init function for a description of the priorities string.
- dsn_notify (off|condition)
- This command sets the condition(s) under which the mail system should send DSN (Delivery Status Notification) messages. The argument off disables explicit DSN requests, which means the mail system decides when to send DSN messages. This is the default. The condition must be never, to never request notification, or a comma separated list (no spaces!) of one or more of the following: failure, to request notification on transmission failure, delay, to be notified of message delays, success, to be notified of successful transmission. The SMTP server must support the DSN extension.
- dsn_return (off|amount)
- This command controls how much of a mail should be returned in DSN (Delivery Status Notification) messages. The argument off disables explicit DSN requests, which means the mail system decides how much of a mail it returns in DSN messages. This is the default. The amount must be headers, to just return the message headers, or full, to return the full mail. The SMTP server must support the DSN extension.
- domain argument
- Use this command to set the argument of the SMTP EHLO (or LMTP LHLO) command. The default is localhost, which is stupid but usually works. Try to change the default if mails get rejected due to anti-SPAM measures. Possible choices are the domain part of your mail address (provider.example for joe@provider.example) or the fully qualified domain name of your host (if available).
- keepbcc [(on|off)]
- This command controls whether to remove or keep the Bcc header when sending a mail. The default is to remove it.
- logfile [file]
- An empty argument disables logging (this is the default).
- syslog [(on|off|facility)]
- Enable or disable syslog logging. The facility can be one
of LOG_USER, LOG_MAIL, LOG_LOCAL0, ..., LOG_LOCAL7. The default is
LOG_USER.
- aliases [file]
- Replace local recipients with addresses in the aliases
file. The aliases file is a plain text file containing mappings between a
local address and a list of domain addresses. A local address is defined
as one without an `@' character and a domain address is one with an `@'
character. The mappings are of the form:
local: someone@example.com, person@domain.example
EXAMPLES¶
Configuration file # Set default values for all following accounts.FILES¶
- SYSCONFDIR/msmtprc
- System configuration file. Use --version to find out what SYSCONFDIR is on your platform.
- ~/.msmtprc
- User configuration file.
- ~/.netrc and SYSCONFDIR/netrc
- The netrc file contains login information. If a password is not found in the configuration file, msmtp will search it in ~/.netrc and SYSCONFDIR/netrc before prompting the user for it. The syntax of netrc files is described in netrc(5) or ftp(1).
ENVIRONMENT¶
- USER, LOGNAME
- These variables override the user's login name when constructing an envelope-from address. LOGNAME is only used if USER is unset.
- TMPDIR
- Directory to create temporary files in. If this is unset, a
system specific default directory is used.
- EMAIL, SMTPSERVER
- These environment variables are used only if neither --host nor --account is used and there is no default account defined in the configuration files. In this case, the host name is taken from SMTPSERVER, and the envelope from address is taken from EMAIL, unless overridden by --from or --read-envelope-from. Currently SMTPSERVER must contain a plain host name (no URL), and EMAIL must contain a plain address (no names or additional information).
AUTHORS¶
msmtp was written by Martin Lambers <marlam@marlam.de>.SEE ALSO¶
mutt(1), mail(1), sendmail(8), netrc(5) or ftp(1)2012-05 |