<html lang="en"> <head> <title>msmtp 1.4.4</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="msmtp 1.4.4"> <meta name="generator" content="makeinfo 4.7"> <link title="Top" rel="top" href="#Top"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This manual was last updated August 15, 2005 for version 1.4.4 of msmtp. Copyright (C) 2005 Martin Lambers This program, including this manual, is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program, including this manual, is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family: serif; font-weight: normal; } --></style> </head> <body> <h1 class="settitle">msmtp 1.4.4</h1> <div class="contents"> <h2>Table of Contents</h2> <ul> <li><a name="toc_Top" href="#Top">msmtp</a> <li><a name="toc_Introduction" href="#Introduction">1 Introduction</a> <li><a name="toc_Configuration-files" href="#Configuration-files">2 Configuration files</a> <ul> <li><a href="#Configuration-files">2.1 General commands</a> <li><a href="#Configuration-files">2.2 Authentication commands</a> <li><a href="#Configuration-files">2.3 TLS commands</a> <li><a href="#Configuration-files">2.4 Commands specific to sendmail mode</a> </li></ul> <li><a name="toc_Invocation" href="#Invocation">3 Invocation</a> <ul> <li><a href="#Invocation">3.1 Synopsis</a> <li><a href="#Invocation">3.2 Options</a> <ul> <li><a href="#Invocation">3.2.1 General options</a> <li><a href="#Invocation">3.2.2 Changing the mode of operation</a> <li><a href="#Invocation">3.2.3 Configuration options</a> <li><a href="#Invocation">3.2.4 Options specific to sendmail mode</a> </li></ul> <li><a href="#Invocation">3.3 Choosing an account</a> <li><a href="#Invocation">3.4 Exit code</a> <li><a href="#Invocation">3.5 Environment / Files</a> </li></ul> <li><a name="toc_SMTP-features" href="#SMTP-features">4 SMTP features</a> <ul> <li><a href="#Transport-Layer-Security">4.1 Transport Layer Security</a> <li><a href="#Authentication">4.2 Authentication</a> <li><a href="#Delivery-Status-Notifications">4.3 Delivery Status Notifications</a> </li></ul> <li><a name="toc_Sendmail-mode" href="#Sendmail-mode">5 Sendmail mode</a> <ul> <li><a href="#Envelope_002dfrom-address">5.1 Envelope-from address</a> <li><a href="#Logging">5.2 Logging</a> <li><a href="#Bcc-header">5.3 Bcc header</a> </li></ul> <li><a name="toc_Server-information-mode" href="#Server-information-mode">6 Server information mode</a> <li><a name="toc_Remote-Message-Queue-Starting-mode" href="#Remote-Message-Queue-Starting-mode">7 Remote Message Queue Starting mode</a> <li><a name="toc_Examples" href="#Examples">8 Examples</a> <ul> <li><a href="#A-system-wide-configuration-file">8.1 A system wide configuration file</a> <li><a href="#A-user-configuration-file">8.2 A user configuration file</a> <li><a href="#Using-msmtp-with-Mutt">8.3 Using msmtp with Mutt</a> <li><a href="#Using-msmtp-with-mail">8.4 Using msmtp with mail</a> </li></ul> <li><a name="toc_Development" href="#Development">9 Development</a> </li></ul> </div> <div class="node"> <p><hr> <a name="Top"></a>Next: <a rel="next" accesskey="n" href="#Introduction">Introduction</a>, Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> <br> </div> <h2 class="unnumbered">msmtp</h2> <p>This manual was last updated August 15, 2005 for version 1.4.4 of msmtp. <p>Copyright (C) 2005 Martin Lambers <blockquote> This program, including this manual, is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. <p>This program, including this manual, is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. <p>You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA </blockquote> <ul class="menu"> <li><a accesskey="1" href="#Introduction">Introduction</a>: Basic concepts. <li><a accesskey="2" href="#Configuration-files">Configuration files</a>: Configuration file commands. <li><a accesskey="3" href="#Invocation">Invocation</a>: Command line options. <li><a accesskey="4" href="#SMTP-features">SMTP features</a>: Explanation of various SMTP features. <li><a accesskey="5" href="#Sendmail-mode">Sendmail mode</a>: How to send mail. <li><a accesskey="6" href="#Server-information-mode">Server information mode</a>: How to obtain information about an SMTP server. <li><a accesskey="7" href="#Remote-Message-Queue-Starting-mode">Remote Message Queue Starting mode</a>: How to send RMQS requests. <li><a accesskey="8" href="#Examples">Examples</a>: Usage examples. <li><a accesskey="9" href="#Development">Development</a>: About the development process. </ul> <div class="node"> <p><hr> <a name="Introduction"></a>Next: <a rel="next" accesskey="n" href="#Configuration-files">Configuration files</a>, Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">1 Introduction</h2> <p>msmtp is an SMTP client. <p>In its main mode of operation, it reads a mail from standard input and sends it to a predefined SMTP server that takes care of proper delivery. Command line options and exit codes are compatible to sendmail. <p>Supported SMTP features include: <ul> <li>Authentication methods PLAIN, LOGIN, CRAM-MD5 and EXTERNAL (and GSSAPI, DIGEST-MD5 and NTLM when compiled with GNU SASL support) <li>TLS encrypted connections with the OpenSSL or GnuTLS libraries (including server certificate verification and the possibility to send a client certificate) <li>DSN (Delivery Status Notification) support <li>PIPELINING support for increased transmission speed <li>RMQS (Remote Message Queue Starting) support (ETRN keyword) </ul> <p>The best way to start is probably to have a look at the Examples section. See <a href="#Examples">Examples</a>. <p>In addition to sendmail mode, there are two other modes of operation: <ul> <li>Server information mode. In this mode, msmtp prints as much information as it can get about a given SMTP server (supported features, maximum mail size, <small class="dots">...</small>). <li>Remote Message Queue Starting mode. In this mode, msmtp sends a Remote Message Queue Starting request for a host, domain, or queue to a given SMTP server. </ul> <p>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. <p>The 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. <div class="node"> <p><hr> <a name="Configuration-files"></a>Next: <a rel="next" accesskey="n" href="#Invocation">Invocation</a>, Previous: <a rel="previous" accesskey="p" href="#Introduction">Introduction</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">2 Configuration files</h2> <p>msmtp supports a system wide configuration file and a user configuration file. Both are optional and need not exist. <p>If it exists and is readable, a system wide configuration file <code>SYSCONFDIR/msmtprc</code> will be loaded, where <code>SYSCONFDIR</code> depends on your platform; the default is <code>/usr/local/etc</code>. Use <code>--version</code> to find out which directory is used. <p>If it exists and is readable, a user configuration file will be loaded (<code>$HOME/.msmtprc</code> by default). Accounts defined in the user configuration file override accounts from the system configuration file. The user configuration file must have no more permissions than user read/write. Configuration data from either file can be changed by command line options. <p>A configuration file is a simple text file. Empty lines and comment lines (whose first non-blank character is '#') are ignored. Every other line must contain a command and may contain an argument to that command. The argument may be enclosed in double quotes ("). <p>If the first character of a filename is the tilde (~), this tilde will be replaced by <code>$HOME</code>. If a command accepts the argument <span class="samp">on</span>, it also accepts an empty argument and treats that the same as <span class="samp">on</span>. <p>Commands form groups. Each group starts with the <span class="samp">account</span> command and defines the settings for one SMTP server. <p>See <a href="#Examples">Examples</a>. <h3 class="section">2.1 General commands</h3> <dl> <a name="defaults"></a> <dt><span class="samp">defaults</span><dd><a name="index-defaults-1"></a>Set defaults. The following configuration commands will set default values for all following account definitions in the current configuration file. <a name="account"></a> <br><dt><span class="samp">account </span><var>name</var><span class="samp"> [: </span><var>account</var><span class="samp">[,...]]</span><dd><a name="index-account-2"></a>Start a new account definition with the given name. The current default values are filled in (see <a href="#defaults">defaults</a>).<br> If a colon and a list of previously defined accounts is given after the account name, the new account, with the filled in default values, will inherit all settings from the accounts in the list. <a name="host"></a> <br><dt><span class="samp">host </span><var>hostname</var><dd><a name="index-host-3"></a>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. <a name="port"></a> <br><dt><span class="samp">port </span><var>number</var><dd><a name="index-port-4"></a>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" (2003). <a name="timeout"></a> <br><dt><span class="samp">timeout (off|</span><var>seconds</var><span class="samp">)</span><dd><a name="index-timeout-5"></a>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. For compatibility with older versions, <span class="samp">connect_timeout</span> is accepted as an alias for this command. <a name="protocol"></a> <br><dt><span class="samp">protocol (smtp|lmtp)</span><dd><a name="index-protocol-6"></a>Set the protocol to use. Currently only SMTP and LMTP are supported. SMTP is the default. See <a href="#port">port</a> for default ports. <a name="domain"></a> <br><dt><span class="samp">domain </span><var>argument</var><dd><a name="index-domain-7"></a>This command sets the argument of the SMTP EHLO (or LMTP LHLO) command. The default is <span class="samp">localhost</span> (stupid, but working). Possible choices are the domain part of your mail address (<code>provider.example</code> for <code>joe@provider.example</code>) or the fully qualified domain name of your host (if available). </dl> <h3 class="section">2.2 Authentication commands</h3> <p>See <a href="#Authentication">Authentication</a>. <dl> <a name="auth"></a> <dt><span class="samp">auth [(on|off|</span><var>method</var><span class="samp">)]</span><dd><a name="index-auth-8"></a>This command enables or disables SMTP authentication and optionally chooses an authentication method to use. It should not be necessary to choose a method; with the argument on, msmtp will choose the best one available. Accepted methods are plain, cram-md5, digest-md5, gssapi, external, login, and ntlm. See <a href="#Authentication">Authentication</a>.<br> <a name="user"></a> <br><dt><span class="samp">user [</span><var>username</var><span class="samp">]</span><dd><a name="index-user-9"></a>Set your user name for SMTP authentication. An empty argument unsets the user name. Authentication must be activated with the <span class="samp">auth</span> command. <a name="password"></a> <br><dt><span class="samp">password [</span><var>secret</var><span class="samp">]</span><dd><a name="index-password-10"></a>Set your password for SMTP authentication. An empty argument unsets the password. Authentication must be activated with the <span class="samp">auth</span> command. If no password is set but one is needed during authentication, msmtp will try to find it in <code>~/.netrc</code>, and if that fails, msmtp will prompt you for it. See <a href="#Authentication">Authentication</a>. <a name="ntlmdomain"></a> <br><dt><span class="samp">ntlmdomain [</span><var>ntlmdomain</var><span class="samp">]</span><dd><a name="index-ntlmdomain-11"></a>Set a domain for the <span class="samp">ntlm</span> 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. </dl> <h3 class="section">2.3 TLS commands</h3> <p>See <a href="#Transport-Layer-Security">Transport Layer Security</a>. <dl> <a name="tls"></a> <dt><span class="samp">tls [(on|off)]</span><dd><a name="index-tls-12"></a>This command enables or disables TLS/SSL encrypted connections to the SMTP server. Not every server supports TLS, and a few that do require the <span class="samp">tls_starttls off</span> command. See <a href="#Transport-Layer-Security">Transport Layer Security</a>. <a name="tls_005ftrust_005ffile"></a> <br><dt><span class="samp">tls_trust_file [</span><var>file</var><span class="samp">]</span><dd><a name="index-tls_005ftrust_005ffile-13"></a>This command activates strict server certificate verification. The file must contain one or more certificates of trusted Certification Authorities (CAs) in PEM format. An empty argument disables this feature. See <a href="#Transport-Layer-Security">Transport Layer Security</a>. <a name="tls_005fkey_005ffile"></a> <br><dt><span class="samp">tls_key_file [</span><var>file</var><span class="samp">]</span><dd><a name="index-tls_005fkey_005ffile-14"></a>This command (together with the <span class="samp">tls_cert_file</span>) 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. See <a href="#Transport-Layer-Security">Transport Layer Security</a>. <a name="tls_005fcert_005ffile"></a> <br><dt><span class="samp">tls_cert_file [</span><var>file</var><span class="samp">]</span><dd><a name="index-tls_005fcert_005ffile-15"></a>This command (together with the <span class="samp">tls_key_file</span> 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. See <a href="#Transport-Layer-Security">Transport Layer Security</a>. <a name="tls_005fcertcheck"></a> <br><dt><span class="samp">tls_certcheck [(on|off)]</span><dd><a name="index-tls_005fcertcheck-16"></a>This command enables or disables sanity checks for the server certificate. These checks are enabled by default, but can cause difficulties. See <a href="#Transport-Layer-Security">Transport Layer Security</a>. For compatibility with older versions, <span class="samp">tls_nocertcheck</span> is accepted as an alias for <span class="samp">tls_certcheck off</span>. <a name="tls_005fstarttls"></a> <br><dt><span class="samp">tls_starttls [(on|off)]</span><dd><a name="index-tls_005fstarttls-17"></a>This command enables or disables the use of the STARTTLS SMTP command to start TLS encryption. It is enabled by default. See <a href="#Transport-Layer-Security">Transport Layer Security</a>. For compatibility with older versions, <span class="samp">tls_nostarttls</span> is accepted as an alias for <span class="samp">tls_starttls off</span>. </dl> <h3 class="section">2.4 Commands specific to sendmail mode</h3> <p>See <a href="#Sendmail-mode">Sendmail mode</a>. <dl> <a name="auto_005ffrom"></a> <dt><span class="samp">auto_from [(on|off)]</span><dd><a name="index-auto_005ffrom-18"></a>Enable or disable automatic envelope-from addresses. The default is off.<br> When enabled, an envelope-from address of the form user@domain will be generated. The local part will be set to <code>$USER</code> or, if that fails, to <code>$LOGNAME</code> or, if that fails, to the login name of the current user. The domain part can be set with the <span class="samp">maildomain</span> command (see <a href="#maildomain">maildomain</a>). If the maildomain is empty, the envelope-from address will only consist of the user name and not have a domain part.<br> When disabled, the envelope-from address must be set explicitly.<br> See <a href="#Envelope_002dfrom-address">Envelope-from address</a>. <a name="from"></a> <br><dt><span class="samp">from [</span><var>address</var><span class="samp">]</span><dd><a name="index-from-19"></a>Set the envelope-from address. This address will only be used when <span class="samp">auto_from</span> is off. See <a href="#Envelope_002dfrom-address">Envelope-from address</a>. <a name="maildomain"></a> <br><dt><span class="samp">maildomain [</span><var>domain</var><span class="samp">]</span><dd><a name="index-maildomain-20"></a>Set a domain part for the generation of an envelope-from address. This is only used when <span class="samp">auto_from</span> is on. The domain may be empty. See <a href="#Envelope_002dfrom-address">Envelope-from address</a>. <a name="dsn_005fnotify"></a> <br><dt><span class="samp">dsn_notify (off|</span><var>conditions</var><span class="samp">)</span><dd><a name="index-dsn_005fnotify-21"></a>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 <var>condition</var> must be <span class="samp">never</span>, to never request notification, or a comma separated list (no spaces!) of one or more of the following: <span class="samp">failure</span>, to request notification on transmission failure, <span class="samp">delay</span>, to be notified of message delays, <span class="samp">success</span>, to be notified of successful transmission. The SMTP server must support the DSN extension. See <a href="#Delivery-Status-Notifications">Delivery Status Notifications</a>. <a name="dsn_005freturn"></a> <br><dt><span class="samp">dsn_return (off|</span><var>amount</var><span class="samp">)</span><dd><a name="index-dsn_005freturn-22"></a>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 <var>amount</var> must be <span class="samp">headers</span>, to just return the message headers, or <span class="samp">full</span>, to return the full mail. The SMTP server must support the DSN extension. See <a href="#Delivery-Status-Notifications">Delivery Status Notifications</a>. <a name="keepbcc"></a> <br><dt><span class="samp">keepbcc [(on|off)]</span><dd><a name="index-keepbcc-23"></a>This command controls whether to remove or keep the Bcc header when sending a mail. The default is to remove it. See <a href="#Bcc-header">Bcc header</a>. <a name="logfile"></a> <br><dt><span class="samp">logfile [</span><var>file</var><span class="samp">]</span><dd><a name="index-logfile-24"></a>This command enables or disables logging to the specified file. An empty argument disables this feature. The file name <span class="samp">-</span> directs the log information to standard output. See <a href="#Logging">Logging</a>. <a name="syslog"></a> <br><dt><span class="samp">syslog [(on|off|</span><var>facility</var><span class="samp">)]</span><dd><a name="index-syslog-25"></a>This command enables or disables syslog logging. The facility can be one of <span class="samp">LOG_USER</span>, <span class="samp">LOG_MAIL</span>, <span class="samp">LOG_LOCAL0</span>, <small class="dots">...</small>, <span class="samp">LOG_LOCAL7</span>. The default facility is <span class="samp">LOG_USER</span>. Syslog logging is disabled by default. See <a href="#Logging">Logging</a>. </dl> <div class="node"> <p><hr> <a name="Invocation"></a>Next: <a rel="next" accesskey="n" href="#SMTP-features">SMTP features</a>, Previous: <a rel="previous" accesskey="p" href="#Configuration-files">Configuration files</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">3 Invocation</h2> <h3 class="section">3.1 Synopsis</h3> <ul> <li>Sendmail mode (default):<br> <code>msmtp [</code><var>option</var><code>...] [--] </code><var>recipient</var><code>...</code><br> <code>msmtp [</code><var>option</var><code>...] -t [--] [</code><var>recipient</var><code>...]</code> <li>Server information mode:<br> <code>msmtp [</code><var>option</var><code>...] --serverinfo</code> <li>Remote Message Queue Starting mode:<br> <code>msmtp [</code><var>option</var><code>...] --rmqs=(</code><var>host</var><code>|</code><var>@domain</var><code>|</code><var>#queue</var><code>)</code> </ul> <h3 class="section">3.2 Options</h3> <p>Options override configuration file settings. They are compatible with sendmail where appropriate. <h4 class="subsection">3.2.1 General options</h4> <dl> <dt><span class="samp">--version</span><dd><a name="index-_002d_002dversion-26"></a>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. <br><dt><span class="samp">--help</span><dd><a name="index-_002d_002dhelp-27"></a>Print help. <br><dt><span class="samp">-P</span><dt><span class="samp">--pretend</span><dd><a name="index-_002dP-28"></a><a name="index-_002d_002dpretend-29"></a>Print the configuration settings that would be used, but do not take further action. An asterisk ('*') will be printed instead of the password. <br><dt><span class="samp">-d</span><dt><span class="samp">--debug</span><dd><a name="index-_002dd-30"></a><a name="index-_002d_002ddebug-31"></a>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! </dl> <h4 class="subsection">3.2.2 Changing the mode of operation</h4> <dl> <a name="_002d_002dserverinfo"></a> <dt><span class="samp">-S</span><dt><span class="samp">--serverinfo</span><dd><a name="index-_002dS-32"></a><a name="index-_002d_002dserverinfo-33"></a>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). See <a href="#Server-information-mode">Server information mode</a>. <dt><span class="samp">--rmqs=(</span><var>host</var><span class="samp">|</span><var>@domain</var><span class="samp">|</span><var>#queue</var><span class="samp">)</span><dd><a name="index-_002d_002drmqs-34"></a>Send a Remote Message Queue Starting request for the given host, domain, or queue to the SMTP server and exit. See <a href="#Remote-Message-Queue-Starting-mode">Remote Message Queue Starting mode</a>. </dl> <h4 class="subsection">3.2.3 Configuration options</h4> <p>Most options in this category correspond to a configuration file command. Please refer to <a href="#Configuration-files">Configuration files</a> for detailed information. <dl> <dt><span class="samp">-C </span><var>filename</var><dt><span class="samp">--file=</span><var>filename</var><dd><a name="index-_002dC-35"></a><a name="index-_002d_002dfile-36"></a>Use the given file instead of <code>$HOME/.msmtprc</code> as the user configuration file. <br><dt><span class="samp">-a </span><var>account</var><dt><span class="samp">--account=</span><var>account</var><dd><a name="index-_002da-37"></a><a name="index-_002d_002daccount-38"></a>Use the given account instead of the account named <span class="samp">default</span>. This option cannot be used together with the <span class="samp">--host</span> option. See <a href="#Choosing-an-account">Choosing an account</a>. <dt><span class="samp">--host=</span><var>hostname</var><dd><a name="index-_002d_002dhost-39"></a>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 <span class="samp">--account</span> option. It disables loading of configuration files. See <a href="#Choosing-an-account">Choosing an account</a>. <dt><span class="samp">--port=</span><var>number</var><dd><a name="index-_002d_002dport-40"></a>Set the port number to connect to. See <a href="#port">port</a>. <dt><span class="samp">--timeout=(off|</span><var>seconds</var><span class="samp">)</span><dd><a name="index-_002d_002dtimeout-41"></a>Set a network timeout. See <a href="#timeout">timeout</a>. For compatibility with older versions, <span class="samp">--connect-timeout</span> is accepted as an alias for this option. <dt><span class="samp">--protocol=(smtp|lmtp)</span><dd><a name="index-_002d_002dprotocol-42"></a>Set the protocol. See <a href="#protocol">protocol</a>. <dt><span class="samp">--domain=[</span><var>argument</var><span class="samp">]</span><dd><a name="index-_002d_002ddomain-43"></a>Set the argument of the SMTP EHLO (or LMTP LHLO) command. See <a href="#domain">domain</a>. <a name="_002d_002dauth"></a> <dt><span class="samp">--auth[=(on|off|</span><var>method</var><span class="samp">)]</span><dd><a name="index-_002d_002dauth-44"></a>Enable or disable authentication and optionally choose the method. See <a href="#auth">auth</a>. <a name="_002d_002duser"></a> <dt><span class="samp">--user=[</span><var>username</var><span class="samp">]</span><dd><a name="index-_002d_002duser-45"></a>Set or unset the user name for authentication. See <a href="#user">user</a>. <dt><span class="samp">--tls[=(on|off)]</span><dd><a name="index-_002d_002dtls-46"></a>Enable or disable TLS. See <a href="#tls">tls</a>. <a name="_002d_002dtls_002dtrust_002dfile"></a> <dt><span class="samp">--tls-trust-file=[</span><var>file</var><span class="samp">]</span><dd><a name="index-_002d_002dtls_002dtrust_002dfile-47"></a>Set or unset a trust file for TLS encryption. See <a href="#tls_005ftrust_005ffile">tls_trust_file</a>. <a name="_002d_002dtls_002dkey_002dfile"></a> <dt><span class="samp">--tls-key-file=[</span><var>file</var><span class="samp">]</span><dd><a name="index-_002d_002dtls_002dkey_002dfile-48"></a>Set or unset a key file for TLS encryption. See <a href="#tls_005fkey_005ffile">tls_key_file</a>. <a name="_002d_002dtls_002dcert_002dfile"></a> <dt><span class="samp">--tls-cert-file=[</span><var>file</var><span class="samp">]</span><dd><a name="index-_002d_002dtls_002dcert_002dfile-49"></a>Set or unset a cert file for TLS encryption. See <a href="#tls_005fcert_005ffile">tls_cert_file</a>. <a name="_002d_002dtls_002dcertcheck"></a> <dt><span class="samp">--tls-certcheck[=(on|off)]</span><dd><a name="index-_002d_002dtls_002dcertcheck-50"></a>Enable or disable server certificate checks for TLS encryption. See <a href="#tls_005fcertcheck">tls_certcheck</a>. <a name="_002d_002dtls_002dstarttls"></a> <dt><span class="samp">--tls-starttls[=(on|off)]</span><dd><a name="index-_002d_002dtls_002dstarttls-51"></a>Enable or disable STARTTLS for TLS encryption. See <a href="#tls_005fstarttls">tls_starttls</a>. </dl> <h4 class="subsection">3.2.4 Options specific to sendmail mode</h4> <dl> <a name="_002d_002dauto_002dfrom"></a> <dt><span class="samp">--auto-from[=(on|off)]</span><dd><a name="index-_002d_002dauto_002dfrom-52"></a>Enable or disable automatic envelope-from addresses. The default is off. See <a href="#auto_005ffrom">auto_from</a>. <a name="_002d_002dfrom"></a> <br><dt><span class="samp">-f </span><var>address</var><dt><span class="samp">--from=</span><var>address</var><dd><a name="index-_002df-53"></a><a name="index-_002d_002dfrom-54"></a>Set the envelope-from address. It is only used when <span class="samp">auto_from</span> is off. See <a href="#from">from</a>.<br> If no account was chosen yet (with <span class="samp">--account</span> or <span class="samp">--host</span>), this option will choose the first account that has the given envelope-from address (set with the <span class="samp">from</span> command). If no such account is found, "default" is used. See <a href="#Choosing-an-account">Choosing an account</a>. <a name="_002d_002dmaildomain"></a> <dt><span class="samp">--maildomain=[</span><var>domain</var><span class="samp">]</span><dd><a name="index-_002d_002dmaildomain-55"></a>Set the domain part for generated envelope-from addresses. It is only used when <span class="samp">auto_from</span> is on. See <a href="#maildomain">maildomain</a>. <a name="_002d_002ddsn_002dnotify"></a> <br><dt><span class="samp">-N (off|</span><var>condition</var><span class="samp">)</span><dt><span class="samp">--dsn-notify=(off|</span><var>condition</var><span class="samp">)</span><dd><a name="index-_002dN-56"></a><a name="index-_002d_002ddsn_002dnotify-57"></a>Set or unset DSN notification conditions. See <a href="#dsn_005fnotify">dsn_notify</a>. <a name="_002d_002ddsn_002dreturn"></a> <br><dt><span class="samp">-R (off|</span><var>amount</var><span class="samp">)</span><dt><span class="samp">--dsn-return=(off|</span><var>amount</var><span class="samp">)</span><dd><a name="index-_002dR-58"></a><a name="index-_002d_002ddsn_002dreturn-59"></a>Set or unset the DSN notification amount. See <a href="#dsn_005freturn">dsn_return</a>. Note that <span class="samp">hdrs</span> is accepted as an alias for <span class="samp">headers</span> to be compatible with sendmail. <a name="_002d_002dkeepbcc"></a> <dt><span class="samp">--keepbcc[=(on|off)]</span><dd><a name="index-_002d_002dkeepbcc-60"></a>Enable or disable the preservation of the Bcc header. See <a href="#keepbcc">keepbcc</a>. <a name="_002d_002dlogfile"></a> <br><dt><span class="samp">-X [</span><var>file</var><span class="samp">]</span><dt><span class="samp">--logfile=[</span><var>file</var><span class="samp">]</span><dd><a name="index-_002dX-61"></a><a name="index-_002d_002dlogfile-62"></a>Set or unset the log file. See <a href="#logfile">logfile</a>. <a name="_002d_002dsyslog"></a> <dt><span class="samp">--syslog[=(on|off|</span><var>facility</var><span class="samp">)]</span><dd><a name="index-_002d_002dsyslog-63"></a>Enable or disable syslog logging. See <a href="#syslog">syslog</a>. <br><dt><span class="samp">-t</span><dt><span class="samp">--read-recipients</span><dd><a name="index-_002dt-64"></a><a name="index-_002d_002dread_002drecipients-65"></a>Send the mail to the recipients given in the To, Cc, and Bcc headers of the mail in addition to the recipients given on the command line.<br> This requires a temporary file to buffer the mail headers; see <a href="#Environment-_002f-Files">Environment / Files</a>. <dt><span class="samp">--</span><dd>This marks the end of options. All following arguments will be treated as recipient addresses, even if they start with a '-'. </dl> <p>The following options are accepted but ignored for sendmail compatibility: <span class="samp">-B</span><var>type</var>, <span class="samp">-bm</span>, <span class="samp">-F</span><var>name</var>, <span class="samp">-G</span>, <span class="samp">-hN</span>, <span class="samp">-i</span>, <span class="samp">-L </span><var>tag</var>, <span class="samp">-m</span>, <span class="samp">-n</span>, <span class="samp">-O option=</span><var>value</var>, <span class="samp">-ox </span><var>value</var>, <span class="samp">-v</span> <p><a name="Choosing-an-account"></a> <h3 class="section">3.3 Choosing an account</h3> <p>There are three ways to choose the account to use. It depends on the circumstances which method is the best. <ol type=1 start=1> <li><span class="samp">--account=</span><var>account</var><br> Use the given account. Command line settings override configuration file settings. <li><span class="samp">--host=</span><var>hostname</var><br> Use only the settings from the command line; do not use any configuration file data. <li><span class="samp">--from=</span><var>address</var><br> Choose the first account from the system or user configuration file that has a matching envelope-from address as specified by a <span class="samp">from</span> command. This works only when neither <span class="samp">--account</span> nor <span class="samp">--host</span> is used. </ol> If none of the above options is used (or if <span class="samp">--from</span> is used but no account has a matching <span class="samp">from</span> command), then the account "default" is used. <h3 class="section">3.4 Exit code</h3> <p>The standard exit codes from <code>sysexits.h</code> are used. <p><a name="Environment-_002f-Files"></a> <h3 class="section">3.5 Environment / Files</h3> <dl> <dt><code>SYSCONFDIR/msmtprc</code><dd>The system configuration file. Use the <span class="samp">--version</span> option to find out what <code>SYSCONFDIR</code> is on your platform. <br><dt><code>$HOME/.msmtprc</code><dd>The default user configuration file. <br><dt><code>$HOME/.netrc</code><dd>The <code>.netrc</code> file contains login information. If a password is not found in the configuration file, msmtp will search it in <code>.netrc</code> before prompting the user for it. The syntax of <code>.netrc</code> is described in the <code>netrc(5)</code> or <code>ftp(1)</code> manual page. <br><dt><code>$USER</code><span class="samp">, </span><code>$LOGNAME</code><dd>These variables override the user's login name when constructing an envelope-from address. <code>LOGNAME</code> is only used if <code>USER</code> is unset. <br><dt><code>$TMPDIR</code><dd>Directory to create temporary files in. If this is unset, a system specific default directory is used.<br> A temporary file is only created when the <span class="samp">-t</span>/<span class="samp">--read-recipients</span> option is used. The file is then used to buffer the headers of the mail (but not the body, so the file won't get too large). </dl> <div class="node"> <p><hr> <a name="SMTP-features"></a>Next: <a rel="next" accesskey="n" href="#Sendmail-mode">Sendmail mode</a>, Previous: <a rel="previous" accesskey="p" href="#Invocation">Invocation</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">4 SMTP features</h2> <ul class="menu"> <li><a accesskey="1" href="#Transport-Layer-Security">Transport Layer Security</a>: How to use TLS/SSL <li><a accesskey="2" href="#Authentication">Authentication</a>: How to use authentication <li><a accesskey="3" href="#Delivery-Status-Notifications">Delivery Status Notifications</a>: How to use DSN </ul> <div class="node"> <p><hr> <a name="Transport-Layer-Security"></a>Next: <a rel="next" accesskey="n" href="#Authentication">Authentication</a>, Up: <a rel="up" accesskey="u" href="#SMTP-features">SMTP features</a> <br> </div> <h3 class="section">4.1 Transport Layer Security</h3> <p>Quoting from RFC2246, the TLS 1.0 protocol specification:<br> "The TLS protocol provides communications privacy over the Internet. The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery." <p>SMTP servers can use TLS in one of two modes: <ul> <li>Immediately<br> This is known as SMTP tunneled through TLS. The default port for this mode is 465 (ssmtp). <li>Via the STARTTLS SMTP command<br> The SMTP session begins normally. The client sends the STARTTLS command when it wishes to begin TLS encryption. The default port for this mode is the default SMTP port: 25 (smtp). </ul> msmtp can switch between these modes with the <span class="samp">tls_starttls</span> command (see <a href="#tls_005fstarttls">tls_starttls</a>) command or the <span class="samp">--tls-starttls</span> option (see <a href="#_002d_002dtls_002dstarttls">–tls-starttls</a>). <p>When TLS is started, the server sends a certificate to identify itself. This certificate contains information about the certificate owner, the certificate issuer, and the activation and expiration times of the certificate. This information can be displayed in server information mode. See <a href="#Server-information-mode">Server information mode</a>. <p>Some sanity checks are done with the server certificate. These include: <ul> <li>Does the certificate belong to the host name of the SMTP server? <li>Is the certificate activated? <li>Is the certificate still valid, or has it expired? </ul> Sometimes one of these checks fail. msmtp will abort the connection in this case. If the user still wants to use this SMTP server with TLS, the sanity checks can be switched off with <span class="samp">tls_certcheck</span> or <span class="samp">--tls-certcheck</span> (see <a href="#tls_005fcertcheck">tls_certcheck</a>, <a href="#_002d_002dtls_002dcertcheck">–tls-certcheck</a>). <p>Note that the SMTP server cannot be fully trusted just because the certificate passes the sanity checks. To verify that the user can trust the SMTP server, it is necessary to use a (list of) certificates of Certification Authorities (CAs) that are trusted. If msmtp can verify that the server certificate was issued by one of these CAs, then the SMTP server is trusted. A file containing CA certificates can be set with <span class="samp">tls_trust_file</span> or <span class="samp">--tls-trust-file</span> (see <a href="#tls_005ftrust_005ffile">tls_trust_file</a>, <a href="#_002d_002dtls_002dtrust_002dfile">–tls-trust-file</a>). <p>If the server requests it, the client can send a certificate, too. This allows the server to verify the identity of the client. See the EXTERNAL mechanism in <a href="#Authentication">Authentication</a>. The <span class="samp">tls_key_file</span>/<span class="samp">tls_cert_file</span> commands or the <span class="samp">--tls-key-file</span>/<span class="samp">--tls-cert-file</span> options can be used to set a client certificate. See <a href="#tls_005fkey_005ffile">tls_key_file</a>/<a href="#_002d_002dtls_002dkey_002dfile">–tls-key-file</a>, <a href="#tls_005fcert_005ffile">tls_cert_file</a>/<a href="#_002d_002dtls_002dcert_002dfile">–tls-cert-file</a>. Note that GnuTLS will only send a client certificate if it matches one of the CAs advertised by the server. If you set a client certificate but it is not send to the server, it probably does not match any CA that the server trusts. <div class="node"> <p><hr> <a name="Authentication"></a>Next: <a rel="next" accesskey="n" href="#Delivery-Status-Notifications">Delivery Status Notifications</a>, Previous: <a rel="previous" accesskey="p" href="#Transport-Layer-Security">Transport Layer Security</a>, Up: <a rel="up" accesskey="u" href="#SMTP-features">SMTP features</a> <br> </div> <h3 class="section">4.2 Authentication</h3> <p>Many SMTP servers require a client to authenticate itself before it is allowed to send mail. <p>Multiple authentication methods exist. Most SMTP servers support only some of them. Some methods send authentication data in plain text (or nearly plain text) to the server. These methods should only be used when TLS is active to prevent others from stealing the password. See <a href="#Transport-Layer-Security">Transport Layer Security</a>. <p>msmtp supports a subset of the following authentication methods: <ul> <li><span class="samp">PLAIN</span><br> This authentication method needs a user name and a password. Both are send in BASE64 encoding, which can be easily decoded to plain text. <li><span class="samp">CRAM-MD5</span><br> This authentication method needs a user name and a password. The authentication data is not sent in plain text, which means this method can safely be used without TLS. <li><span class="samp">DIGEST-MD5</span><br> This authentication method needs a user name and a password. The authentication data is not sent in plain text, which means this method can safely be used without TLS. <li><span class="samp">GSSAPI</span><br> This authentication method needs a user name. The Kerberos framework takes care of secure authentication, therefore this method can be used without TLS. <li><span class="samp">EXTERNAL</span><br> This is a special authentication method: The actual authentication happens outside of the SMTP protocol, typically by sending a TLS client certificate (see <a href="#Transport-Layer-Security">Transport Layer Security</a>).<br> The EXTERNAL method merely confirms that this authentication succeeded for the given user (or, if no user name is given, confirms that authentication succeeded). Thus it may not be necessary for authentication to use this method, and if the server does not support the EXTERNAL method, this does not mean that it does not support authentication with TLS client certificates.<br> This authentication method is not chosen automatically; you have to request it manually.<br> Note: Sendmail 8.12.11 advertises the EXTERNAL mechanism only after a TLS client certificate has been send. It seems to ignore the optional user name. Does anyone know more about this? <li><span class="samp">LOGIN</span><br> This is a non-standard authentication method similar to (but worse than) PLAIN. It needs a user name and a password, both of which are send in BASE64 encoding, which can be easily decoded to plain text. <li><span class="samp">NTLM</span><br> This is a obscure non-standard authentication method. It needs a user name and a password and in some cases a special domain parameter (see <a href="#ntlmdomain">ntlmdomain</a>). The authentication data is not send in plain text. </ul> <p>It depends on the underlying authentication library and its version whether a particular method is supported or not. Use the <span class="option">--version</span> to find out which methods are supported by your version of msmtp. <p>Authentication data can be set with the <span class="samp">user</span> and <span class="samp">password</span> commands or with the <span class="samp">--user</span> option. See <a href="#user">user</a>, <a href="#password">password</a>, <a href="#_002d_002duser">–user</a>. If no password is set but one is needed during authentication, msmtp will try to find it in <code>~/.netrc</code>, and if that fails, msmtp will prompt you for it. <p>The authentication method can be chosen with the <span class="samp">auth</span> command or <span class="samp">--auth</span> option, but it is usually sufficient to just use the <span class="samp">on</span> argument to let msmtp choose the method itself. See <a href="#auth">auth</a>, <a href="#_002d_002dauth">–auth</a>. <p>If msmtp chooses the method itself, it will not choose a method that sends plain text authentication data when TLS is not active. This means that only CRAM-MD5, DIGEST-MD5, GSSAPI, and NTLM are available when TLS is inactive. PLAIN and LOGIN are only available when TLS is active. If you really want to send clear text authentication data, you have to force msmtp to do that by setting the authentication method to PLAIN or LOGIN when TLS is off. <div class="node"> <p><hr> <a name="Delivery-Status-Notifications"></a>Previous: <a rel="previous" accesskey="p" href="#Authentication">Authentication</a>, Up: <a rel="up" accesskey="u" href="#SMTP-features">SMTP features</a> <br> </div> <h3 class="section">4.3 Delivery Status Notifications</h3> <p>In situations such as delivery failure or very long delivery delay, the mail system often generates a message for the sender of the mail in question, informing him about the difficulties. <p>Delivery Status Notification (DSN) requests, defined in RFC 3461, try to give the sender of the mail control about how and when these DSN messages are sent. The SMTP server must support the DSN extension. See <a href="#Server-information-mode">Server information mode</a>. <p>A first parameter controls when such messages should be generated: never, on delivery failure, on delivery delay, and/or on success. This can be set with <span class="samp">dsn_notify</span>/<span class="samp">--dsn-notify</span>, see <a href="#dsn_005fnotify">dsn_notify</a>/<a href="#_002d_002ddsn_002dnotify">–dsn-notify</a>. <p>A second parameter controls how much of the original mail should be contained in a DSN message: only the headers, or the full mail. This can be set with <span class="samp">dsn_return</span>/<span class="samp">--dsn-return</span>, see <a href="#dsn_005freturn">dsn_return</a>/<a href="#_002d_002ddsn_002dreturn">–dsn-return</a>. Note that this parameter only applies to DSNs that indicate delivery failure for at least one recipient. If a DSN contains no indications of delivery failure, only the headers of the message are returned. <div class="node"> <p><hr> <a name="Sendmail-mode"></a>Next: <a rel="next" accesskey="n" href="#Server-information-mode">Server information mode</a>, Previous: <a rel="previous" accesskey="p" href="#SMTP-features">SMTP features</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">5 Sendmail mode</h2> <ul class="menu"> <li><a accesskey="1" href="#Envelope_002dfrom-address">Envelope-from address</a>: Information about envelope-from addresses <li><a accesskey="2" href="#Logging">Logging</a>: Different logging methods <li><a accesskey="3" href="#Bcc-header">Bcc header</a>: Bcc header handling </ul> <div class="node"> <p><hr> <a name="Envelope_002dfrom-address"></a>Next: <a rel="next" accesskey="n" href="#Logging">Logging</a>, Up: <a rel="up" accesskey="u" href="#Sendmail-mode">Sendmail mode</a> <br> </div> <h3 class="section">5.1 Envelope-from address</h3> <p>The SMTP server expects a sender mail address for each mail. This is the envelope-from address. It is independent of the From header (because it is part of the mail <em>envelope</em>, not of the mail itself), but in most cases both addresses are the same. <p>Envelope-from addresses can be generated automatically (when <span class="samp">auto_from</span> is enabled with the <span class="samp">auto_from</span> command or <span class="samp">--auto-from</span> option) or set explicitly with the <span class="samp">from</span> command and <span class="samp">--from</span> option. See <a href="#auto_005ffrom">auto_from</a>, <a href="#from">from</a>. <p>When <span class="samp">auto_from</span> is enabled, an envelope-from address of the form user@domain will be generated. The local part will be set to <code>$USER</code> or, if that fails, to <code>$LOGNAME</code> or, if that fails, to the login name of the current user. The domain part can be set with the <span class="samp">maildomain</span> command and <span class="samp">--maildomain</span> option (see <a href="#maildomain">maildomain</a>). If the maildomain is empty, the envelope-from address will only consist of the user name and not have a domain part. <div class="node"> <p><hr> <a name="Logging"></a>Next: <a rel="next" accesskey="n" href="#Bcc-header">Bcc header</a>, Previous: <a rel="previous" accesskey="p" href="#Envelope_002dfrom-address">Envelope-from address</a>, Up: <a rel="up" accesskey="u" href="#Sendmail-mode">Sendmail mode</a> <br> </div> <h3 class="section">5.2 Logging</h3> <p>Logging is enabled on a per account basis. If it is enabled, msmtp will generate one log line for each mail it tries to send via the account in question. <p>The line will include the following information: <ul> <li>Host name of the SMTP server: <code>host=hostname</code> <li>Whether TLS was used: <code>tls=(on|off)</code> <li>Whether authentication was used: <code>auth=(on|off)</code> <li>The user name used for authentication (only if authentication is used): <code>user=name</code> <li>The envelope-from address: <code>from=address</code> <li>The recipient addresses: <code>recipients=addr1,addr2,...</code> <li>The size of the mail as transferred to the server, in bytes (only if the delivery succeeded): <code>mailsize=number</code> <li>The SMTP status code and SMTP error message (only in case of failure and only if available): <code>smtpstatus=number</code>, <code>smtpmsg='message'</code>. Multiline SMTP messages will be concatenated into one line. <li>The msmtp error message (only in case of failure and only if available): <code>errormsg='message'</code> <li>The msmtp exit code (from <code>sysexits.h</code>; <span class="samp">EX_OK</span> indicates success): <code>exitcode=EX_?</code> </ul> <p>If a logfile is given with the <span class="samp">logfile</span> command or <span class="samp">--logfile</span> option, this log line will be prepended with the current date and time and appended to the specified file. See <a href="#logfile">logfile</a>, <a href="#_002d_002dlogfile">–logfile</a>. <p>If syslog logging is enabled with the <span class="samp">syslog</span> command or <span class="samp">--syslog</span> option, the log line is passed to the syslog service with the specified facility. See <a href="#syslog">syslog</a>, <a href="#_002d_002dsyslog">–syslog</a>. <div class="node"> <p><hr> <a name="Bcc-header"></a>Previous: <a rel="previous" accesskey="p" href="#Logging">Logging</a>, Up: <a rel="up" accesskey="u" href="#Sendmail-mode">Sendmail mode</a> <br> </div> <h3 class="section">5.3 Bcc header</h3> <p>The mail will be transmitted unaltered to the SMTP server, with one exception: the Bcc header(s) will be stripped from it before the transmission. This behavior can be changed with the <span class="samp">keepbcc</span> command and <span class="samp">--keepbcc</span> option, see <a href="#keepbcc">keepbcc</a>/<a href="#_002d_002dkeepbcc">–keepbcc</a>. <div class="node"> <p><hr> <a name="Server-information-mode"></a>Next: <a rel="next" accesskey="n" href="#Remote-Message-Queue-Starting-mode">Remote Message Queue Starting mode</a>, Previous: <a rel="previous" accesskey="p" href="#Sendmail-mode">Sendmail mode</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">6 Server information mode</h2> <p>In server information mode, msmtp prints as much information about the SMTP server as it can get and then exits. <p>The SMTP features that can be detected are: <ul> <li>SIZE<br> The maximum message size that the SMTP server accepts. <li>PIPELINING<br> Whether certain SMTP commands may be send in groups rather than one by one. This can speed up mail transmission if the recipient list is long. This feature is used automatically. <li>STARTTLS<br> See <a href="#Transport-Layer-Security">Transport Layer Security</a>. <li>AUTH<br> See <a href="#Authentication">Authentication</a>. <li>DSN<br> See <a href="#Delivery-Status-Notifications">Delivery Status Notifications</a>. <li>ETRN<br> See <a href="#Remote-Message-Queue-Starting-mode">Remote Message Queue Starting mode</a>. </ul> <p>If TLS is activated for server information mode, the following information will be printed about the SMTP server's TLS certificate (if available): <ul> <li>Owner information <ul> <li>Common Name <li>Organization <li>Organizational unit <li>Locality <li>State or Province <li>Country </ul> <li>Issuer information <ul> <li>Common Name <li>Organization <li>Organizational unit <li>Locality <li>State or Province <li>Country </ul> <li>General <ul> <li>Activation time <li>Expiration time <li>SHA1 fingerprint <li>MD5 fingerprint </ul> </ul> <div class="node"> <p><hr> <a name="Remote-Message-Queue-Starting-mode"></a>Next: <a rel="next" accesskey="n" href="#Examples">Examples</a>, Previous: <a rel="previous" accesskey="p" href="#Server-information-mode">Server information mode</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">7 Remote Message Queue Starting mode</h2> <p>Remote Message Queue Starting (RMQS) is defined in RFC 1985. It is a way for a client to request that a server start the processing of its mail queues for messages that are waiting at the server for the client machine. If any messages are at the server for the client, then the server creates a new SMTP session and sends the messages at that time. <p>msmtp can send the <em>request</em> (using the ETRN SMTP command); a mail server on the client side should then accept the connection of the remote SMTP server to receive the mail. <p>Destinations defined in RFC 1985 are: <ul> <li><var>host</var><br> Request the messages for the given host. <li><var>@domain</var><br> Request the messages for the given domain. <li><var>#queue</var><br> Request the delivery of the messages in the given queue. </ul> <div class="node"> <p><hr> <a name="Examples"></a>Next: <a rel="next" accesskey="n" href="#Development">Development</a>, Previous: <a rel="previous" accesskey="p" href="#Remote-Message-Queue-Starting-mode">Remote Message Queue Starting mode</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">8 Examples</h2> <ul class="menu"> <li><a accesskey="1" href="#A-system-wide-configuration-file">A system wide configuration file</a> <li><a accesskey="2" href="#A-user-configuration-file">A user configuration file</a> <li><a accesskey="3" href="#Using-msmtp-with-Mutt">Using msmtp with Mutt</a> <li><a accesskey="4" href="#Using-msmtp-with-mail">Using msmtp with mail</a> </ul> <div class="node"> <p><hr> <a name="A-system-wide-configuration-file"></a>Next: <a rel="next" accesskey="n" href="#A-user-configuration-file">A user configuration file</a>, Up: <a rel="up" accesskey="u" href="#Examples">Examples</a> <br> </div> <h3 class="section">8.1 A system wide configuration file</h3> <pre class="example"> # A system wide configuration is optional. # If it exists, it usually defines a default account. # This allows msmtp to be used like /usr/sbin/sendmail. account default # The SMTP smarthost. host mailhub.oursite.example # Construct envelope-from addresses of the form "user@oursite.example". #auto_from on #maildomain oursite.example # Use TLS. #tls on #tls_trust_file /etc/ssl/certs/ca.pem # Syslog logging with facility LOG_MAIL instead of the default LOG_USER. syslog LOG_MAIL </pre> <div class="node"> <p><hr> <a name="A-user-configuration-file"></a>Next: <a rel="next" accesskey="n" href="#Using-msmtp-with-Mutt">Using msmtp with Mutt</a>, Previous: <a rel="previous" accesskey="p" href="#A-system-wide-configuration-file">A system wide configuration file</a>, Up: <a rel="up" accesskey="u" href="#Examples">Examples</a> <br> </div> <h3 class="section">8.2 A user configuration file</h3> <pre class="example"> # Set default values for all following accounts. defaults tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile ~/.msmtp.log # A freemail service account freemail host smtp.freemail.example from joe_smith@freemail.example auth on user joe.smith password secret # A second mail address at the same freemail service account freemail2 : freemail from joey@freemail.example # The SMTP server of the provider. account provider host mail.provider.example from smithjoe@provider.example auth on user 123 password pwd # Set a default account account default : provider </pre> <div class="node"> <p><hr> <a name="Using-msmtp-with-Mutt"></a>Next: <a rel="next" accesskey="n" href="#Using-msmtp-with-mail">Using msmtp with mail</a>, Previous: <a rel="previous" accesskey="p" href="#A-user-configuration-file">A user configuration file</a>, Up: <a rel="up" accesskey="u" href="#Examples">Examples</a> <br> </div> <h3 class="section">8.3 Using msmtp with Mutt</h3> <p>Create a configuration file for msmtp and add the following lines to your Mutt configuration file: <pre class="example"> set sendmail="/path/to/msmtp" set use_from=yes set realname="Your Name" set from=you@example.com set envelope_from=yes </pre> <p>The envelope_from=yes option lets Mutt use the <span class="option">-f</span> option of msmtp. Therefore msmtp chooses the first account that matches the from address you@example.com. Alternatively, you can use the <span class="option">-a</span> option: <pre class="example"> set sendmail="/path/to/msmtp -a my_account" </pre> <p>See <a href="#Choosing-an-account">Choosing an account</a>. <p>Or set everything from the command line: <pre class="example"> set sendmail="/path/to/msmtp --host=mailhub -f me@example.com --tls" </pre> <p>If you have multiple mail accounts in your msmtp configuration file and let Mutt use the <span class="option">-f</span> option to choose one, you can easily switch accounts in Mutt with the following Mutt configuration lines: <pre class="example"> macro generic "<esc>1" ":set from=you@example.com" macro generic "<esc>2" ":set from=you@your-employer.example" macro generic "<esc>3" ":set from=you@some-other-provider.example" </pre> <p>Now you can use <esc>1, <esc>2, and <esc>3 to switch accounts. <p>The following example uses a different approach: it maps the single key <code><tab></code> in Compose context for switching between the various account in a handy visual way. In the same Compose context, <code>=</code> is mapped in order to show the current msmtp account. This example was contributed by Thomas Baruchel. <pre class="example"> # Define <tab> and = in order to switch or see the current msmtp account # Don't forget to put the right path for msmtp binary macro compose \Cx_ ":set sendmail" macro compose \Cx| "\Cx_ = \"/usr/local/bin/msmtp" macro compose \Cx& ":macro compose \\t \\Cx" macro compose <tab> "\Cx0" macro compose = "\Cx_\n" # Put the account in the following lines (here three accounts) # Don't forget to put the number of the account at the beginning # of the line, and the number of the next account after the '&' macro compose \Cx0 "\Cx|\"\n\Cx&1\n\Cx_\n" # default and switch to 1 macro compose \Cx1 "\Cx| -a example_account\"\n\Cx&2\n\Cx_\n" # switch to 2 macro compose \Cx2 "\Cx| -a gmail\"\n\Cx&0\n\Cx_\n" # switch to 0 # End of the accounts </pre> <div class="node"> <p><hr> <a name="Using-msmtp-with-mail"></a>Previous: <a rel="previous" accesskey="p" href="#Using-msmtp-with-Mutt">Using msmtp with Mutt</a>, Up: <a rel="up" accesskey="u" href="#Examples">Examples</a> <br> </div> <h3 class="section">8.4 Using msmtp with mail</h3> <p>Define a default account, and put the following into your <code>~/.mailrc</code>: <pre class="example"> set sendmail="/path/to/msmtp" </pre> <p>You need to define a default account, because mail does not allow extra options to the msmtp command line. <div class="node"> <p><hr> <a name="Development"></a>Previous: <a rel="previous" accesskey="p" href="#Examples">Examples</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> <br> </div> <h2 class="chapter">9 Development</h2> <p>The homepage of msmtp is <a href="http://msmtp.sourceforge.net/">http://msmtp.sourceforge.net/</a>; the SourceForge project page is <a href="http://sourceforge.net/projects/msmtp/">http://sourceforge.net/projects/msmtp/</a>. <p>The mailing list <code>msmtp-users</code> can be accessed from the project page. <p>Please send any questions, suggestions, and bug reports either to the mailing list or to Martin Lambers (<a href="mailto:marlam@marlam.de">marlam@marlam.de</a>, OpenPGP key: <a href="http://www.marlam.de/key.txt">http://www.marlam.de/key.txt</a>). If you send a bug report, please include the output of <code>msmtp --version</code>. </body></html>