Hello I have setup unattended upgrades on my Ubuntu 20.04 server with msmtp and sendmail.
And want to send the result of Unattended-Upgrade to my email. But the email is not sending by Unattended-Upgrade!
I have add my email Adress to the Unattended-Upgrade settings:
Unattended-Upgrade::Mail "[email protected]";
My /etc/mail.rc
looks like:
set sendmail="/usr/bin/msmtp -t"
My msmtp config (/etc/msmtprc
) looks like:
defaults
port 587
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account [email protected]
host smtp.mail.yahoo.com
from [email protected]
auth on
logfile /var/log/msmtp
user [email protected]
password abc
account default: [email protected]
aliases /etc/aliases
With the permissions:
ls -l /etc/msmtprc
-rw-r----- 1 root msmtp 2741 Dec 15 12:23 /etc/msmtprc
The same config I have in my user Dir (/home/me/.msmtprc
):
ls -l /home/me/.msmtprc
-rw------- 1 me msmtp 2725 Dec 15 09:51 /home/me/.msmtprc
Now I'm able to successfully send emails with:
echo "content" | mail -s "test email" [email protected]
the log of the command above in /var/log/msmtp is:
Dec 15 13:04:31 host=smtp.mail.yahoo.com tls=on auth=on [email protected] [email protected] [email protected] mailsize=153 smtpstatus=250 smtpmsg='250 OK , completed' exitcode=EX_OK
But when I run unattended-upgrade manually sudo /usr/bin/unattended-upgrade -d
I get:
bla bla bla
bla bla bla
bla bla bla
Sending mail to [email protected]
sendmail: the server sent an empty reply
sendmail: could not send mail (account default from /etc/msmtprc)
mail returned: 76
The log of the cammand above is:
Dec 15 13:23:03 host=smtp.mail.yahoo.com tls=on auth=on [email protected] [email protected] [email protected] errormsg='the server sent an empty reply' exitcode=EX_PROTOCOL