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.

1 Answer 1


Warning : My advise is based on Debian msmtp package.

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
  • 1
    This works on Raspbian buster as well! Dec 8, 2020 at 3:31
  • chown: invalid group: ‘root:msmtp’
    – iHad 169
    Jul 10, 2021 at 0:16
  • Check explanation. 1) Is /usr/bin/msmtp installed as set group id? 2) Is it owned by group other than msmtp? ANYWAY: It seem to work on some version of distributions. If it does not work for your name distribution version you use and provide version of msmtp pacjage you installed.
    – AnFi
    Jul 10, 2021 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.