Search code examples
linuxemailovhmsmtp

msmtp cannot send mail via OVH SMTP to root address


I'm trying to get daemons to send email from a Debian 10 Server.

I'm using msmtp-mta with an OVH SMTP server. It's properly configured.

Everything works fine when sending email directly via the mail command, like so :

echo "test" | mail -s "test" [email protected]

However, some daemons like smartd try to send email to root@localhost, but with a malformed recipient address root, which the OVH SMTP doesn't like at all :

send-mail: recipient address root not accepted by the server
send-mail: server message: 501 5.1.3 Invalid address
send-mail: could not send mail (account default from /etc/msmtprc)
Can't send mail: sendmail process failed with error code 65

and in the msmtp log :

Apr 25 00:39:49 host=ssl0.ovh.net tls=on auth=on user=***REDACTED*** from=***REDACTED*** recipients=root smtpstatus=501 smtpmsg='501 5.1.3 Invalid address' errormsg='recipient address root not accepted by the server' exitcode=EX_DATAERR

I tried adding root: [email protected] to /etc/aliases adn relaoding with newaliases, and even put a .forward in root's homedir.

Has anyone experienced this before ? Shouldn't msmtp honor /etc/aliases and/or .forward and replace root's email address ?


Solution

  • Please check with msmtp -v if you have another alias that might override the one you're settings. You'll be able to check if it correctly register your aliases using that command.

    You may also want to add aliases /etc/aliases to your /etc/msmtprc file.

    You may also add a default alias in /etc/aliases if you would like all the mails to be send with a from corresponding: default: [email protected]