10

I am trying to setup Ubuntu 20.04 with msmtp as a system configuration.

I installed msmtp (v1.8.6-1) and heirloom-mailx (v12.5-2+deb7u1build0.14.04.1).

Config file /etc/msmtprc (chmod: 600) has the following:

# Set default values for all accounts.
account default
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        /var/log/msmtp

gmail

host smtp.gmail.com port 587 from <account>@gmail.com user <account> password <password>

Syslog logging with facility LOG_MAIL instead of the default LOG_USER

syslog LOG_MAIL

Log file /var/log/msmtp file mode is 660.

File /etc/mailrc (chmod: 600) contains the following:

set sendmail="/usr/bin/msmtp"

When I try to use sendmail to send an email from terminal I get the following sendmail: account default not found: no configuration file available.

The same error comes up if I directly invoke msmtp.

AnFi
  • 902
chribonn
  • 311

1 Answers1

13

Warning 1 : My advise is based on Debian msmtp package.
Warning 2 : Newer msmtp packages no longer install msmtp as set group id for security reasons.

Recommended Fix: Make /etc/msmtprc owned by group msmtp.

chown root:msmtp /etc/msmtprc
chmod 640 /etc/msmtprc

Explanation: msmtp binary is installed as set group (msmtp) id

$ ls -l /usr/bin/msmtp
-rwxr-sr-x 1 root msmtp 139000 Aug 20 16:24 /usr/bin/msmtp
AnFi
  • 902