I have configured my Debian server to use msmtp for sending mails. Current use case are for example sending a daily report from logwatch to my isp email.

echo "$body" | mutt -s "$topic" -- "myisp@email.com"

I have configured msmtp by means of a global msmtprc file located at /etc/msmtprc. Contents shown below.

The next thing I want to configure is that my email for my root account (e.g., output from crontabs) is sent to my isp email as well.

I have googled around and found, for example on the Arch wiki, that I should just configure my aliases. Which I have done so at the bottom of the msmtp configuration file.

However, after running newaliases, and trying to execute

echo test | mail -s "test message" root

I get the error

send-mail: /etc/aliases: line 2: invalid address 'postmaster'
Can't send mail: sendmail process failed with error code 78

I am unsure how I can fix this. The alias shown below is what was already present. I only added the gmail address.

I think I could just put a new aliases file but that might break other services that rely on this. I.e., I don't know what the proper way to fix this is.


# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: christphe, christophe.detroyer@gmail.com


# ------------------------------------------------------------------------------
# msmtp System Wide Configuration file
# ------------------------------------------------------------------------------

# 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.

# ------------------------------------------------------------------------------
# Accounts
# ------------------------------------------------------------------------------

account isp
host mail.isp.net
port 587
from admin@isp.com
auth login
user admin@isp.com
password foobar
syslog LOG_MAIL

logfile /var/log/msmtp.log

# ------------------------------------------------------------------------------
# Configurations
# ------------------------------------------------------------------------------

# Construct envelope-from addresses of the form "user@oursite.example".
#auto_from on
#maildomain fermmy.server

# Use TLS.
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Syslog logging with facility LOG_MAIL instead of the default LOG_USER.
# Must be done within "account" sub-section above
#syslog LOG_MAIL

# Set a default account
account default : isp

aliases /etc/aliases
# ------------------------------------------------------------------------------#
  • msmtp only accepts aliases of the form root: christophe.detroyer@gmail.com so I should create a /etc/aliases.msmtp with just that line for the moment and change your config. Is mail a link to msmtp? Do you have postfix or sendmail installed too? – meuh Oct 24 '16 at 16:48

Found 2 things today on this when trying msmtp for the first time.

  1. /etc/aliases default of postmaster: root gave things heartburn. Only revealed by msmtp -v

    • solved by changing line to postmaster: root@somewhere.com
  2. put aliases /etc/aliases in /etc/msmtprc or ~/.msmtprc

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.