ssmtp
Send emails from command line
SYNOPSIS
ssmtp [-h] [-a] [-d] [-t] [-v] [-r address] [-m domain] [recipient...]
PARAMETERS
-h
Display help text and exit.
-a
Treat addresses on the command line as arguments to the mail command, rather than recipients (useful when piping mail into ssmtp).
-d
Enable debugging mode (verbose output).
-t
Read recipients from the message 'To:', 'Cc:', and 'Bcc:' headers. Bcc recipients are removed before sending. The recipient list given on the command line is used in addition to those found in the headers. The program will exit if it encounters any error such as invalid headers.
-v
Enable verbose mode (more output than debugging).
-r address
Set the 'From:' address for the message. This overrides the address specified in the configuration file.
-m domain
Set the masquerade domain. This overrides the domain specified in the configuration file.
recipient...
One or more email addresses to send the email to.
DESCRIPTION
ssmtp is an extremely simple MTA (Mail Transfer Agent) with the minimum functionality to deliver mail from a machine to a mail hub. It's designed for systems that only need to send mail and do not need to receive it. ssmtp rewrites all mail to be from a single user, masquerades the hostname, and adds a Received: header. It is useful for providing mail capabilities to machines that normally don't have them, like laptops, embedded systems, and internal-only machines. It is NOT a replacement for a full-fledged MTA like Sendmail, Postfix, or Exim. ssmtp focuses solely on sending mail, making it lightweight and easy to configure.
It is often used to relay mail through an external mail server (like a Gmail account) by using SMTP authentication. Its simplicity makes it a good choice for applications and scripts that need to send notifications or alerts.
CAVEATS
ssmtp is not a full MTA. It cannot receive email and does not handle queues or retries. Configuration is file based, and it has a limited number of configurable options. Its very simple and does not scale. It relays the mail via other MTAs.
ssmtp is obsolete and has not been maintained for a long time. Users should switch to an actively maintained project like msmtp.
CONFIGURATION FILE
The main configuration file for ssmtp is typically located at `/etc/ssmtp/ssmtp.conf`. This file contains settings such as the mailhub (SMTP server), the hostname, and authentication details (username, password) for relaying mail. The root user generally owns the configuration file. The file should contain proper SMTP configurations to avoid email delivery issues.
SECURITY CONSIDERATIONS
Because ssmtp often handles sensitive information like SMTP passwords, it's crucial to protect the configuration file. Restrict access to the file to the root user only (or a dedicated system user) by setting appropriate file permissions (e.g., `chmod 600 /etc/ssmtp/ssmtp.conf`). Be cautious when relaying email through public SMTP servers and always use TLS encryption where possible.
HISTORY
ssmtp was developed to provide a lightweight alternative to more complex MTAs like Sendmail for systems that only needed to send email. Its development focused on simplicity and ease of configuration. However, it's no longer actively maintained, and users are encouraged to consider more modern alternatives like msmtp.