Error output with cron emails via msmtp 0x004e#012

747 Views Asked by At

Usually I install msmtp as the local mailer, setup is much easier than postfix/others and it's quite capable. With this content in /etc/msmtprc

defaults
tls_trust_file /etc/ssl/certs/ca-bundle.crt
account default
host smtp.gmail.com
port 587
tls on
auth on
user [email protected]
password password
from [email protected]
logfile /var/log/msmtp.log
aliases /etc/aliases

I am having the error:

CROND[1587]: (ec2-user) MAIL (mailed 580 bytes of output but got status 0x004e#012)

For all the cron that should send email for ec2-user

Sending with mailx works fine:

echo "TEX" | mailx -s "TEST" [email protected]

Any tips on debugging this issue? I can't find much information about the status code I'm getting

1

There are 1 best solutions below

0
On

Answering myself, I found a way to trigger the error on a verbose way, basically you have to send a mail using sendmail:

echo "From: root \
To: ec2-user \
Subject: Hello World \
\
This is the email body" | sudo sendmail -d -t ec2-user

On the error message I'm getting there the error explanation:

sendmail: /etc/aliases: line 11: invalid address 'postmaster'

Because there where some entries created on the /etc/aliases file (probably they where already there in the ec2 image) with an structure like this:

mailer-daemon: postmaster

Since postmaster does not have any meaning for msmtp, it's throwing the error. After commenting out this lines (#) the mail is being sent normally