msmtp
Send emails via SMTP
TLDR
Send an email using the default account configured in ~/.msmtprc
Send an email using a specific account configured in ~/.msmtprc
Send an email without a configured account. The password should be specified in the ~/.msmtprc file
SYNOPSIS
msmtp [OPTION...] [RECIPIENT...]
PARAMETERS
-a, --account=account
Selects the account configured in the msmtp configuration file, allowing for easy switching between different email identities.
-C, --config=file
Specifies an alternative configuration file to use instead of the default (~/.msmtprc or /etc/msmtprc).
-d, --debug
Enables highly verbose debug output, showing all network traffic and internal operations for troubleshooting.
-v, --verbose
Shows the SMTP conversation between msmtp and the server, providing insight into the communication.
--host=host
Overrides the SMTP server hostname specified in the configuration file for the current command execution.
--port=port
Overrides the SMTP server port. Useful when the server listens on a non-standard port.
--auth=method
Specifies the authentication method to use (e.g., plain, login, cram-md5). Overrides config settings.
--tls
Forces the use of TLS/SSL for encrypted communication with the SMTP server, even if not configured.
--read-envelope-from
Reads the envelope-from address from the mail's From: header, rather than using a configured 'from' address.
-t, --to
Reads recipients from the To:, Cc:, and Bcc: headers in the mail content, ignoring command-line recipients.
--file=file
Reads the email to be sent from the specified file instead of standard input (stdin).
--logfile=file
Appends log messages, including SMTP conversation and errors, to the specified file.
--version
Displays version information for msmtp and exits.
--help
Displays a help message with command-line options and exits.
DESCRIPTION
msmtp is a command-line tool that acts as an SMTP client, designed to send emails from a local machine via an external SMTP server. It reads the email content from standard input or a specified file and forwards it to the configured server. It supports essential features like TLS/SSL encryption, various authentication methods (PLAIN, LOGIN, CRAM-MD5, DIGEST-MD5, GSSAPI), and IPv6.
Highly configurable through a plain text configuration file, msmtp can manage multiple accounts, making it suitable for users with different email identities or servers. It's often used as an MTA (Mail Transfer Agent) by Mail User Agents (MUAs) such as Mutt, Thunderbird, or Evolution for outgoing mail, offering a simple and secure way to dispatch messages without the overhead of a full-fledged mail server.
CAVEATS
Storing passwords directly in the plain text configuration file can be a security risk if the file permissions are not properly secured. It's recommended to use a keyring or a password helper program if sensitive data like passwords are to be used.
CONFIGURATION FILE
msmtp uses a text-based configuration file (defaulting to ~/.msmtprc or /etc/msmtprc) to define accounts, server details, authentication credentials, and TLS settings. This file can contain multiple accounts, allowing for easy switching between different email identities and servers. Permissions for this file should be set securely (e.g., 0600) to protect sensitive information.
MUA INTEGRATION
msmtp is commonly integrated with mail user agents (MUAs) like Mutt, Thunderbird, or Evolution by configuring them to use msmtp as their external sendmail command. This offloads SMTP communication to msmtp, simplifying the MUA's mail sending capabilities and leveraging msmtp's robust authentication and encryption features.
HISTORY
msmtp was developed as a lightweight and secure alternative to traditional full-blown MTAs like Sendmail or Postfix for users who primarily need to send mail via an external SMTP server. Its development started in the early 2000s, focusing on simplicity, configuration via a plain text file, and robust support for modern SMTP features like TLS/SSL and various authentication methods, making it ideal for integration with MUAs on desktop systems.