Score:0

smtp send email on unattended upgrades in Ubuntu

vn flag

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
sol2070 avatar
bo flag
I was having a very similar issue. [This](https://askubuntu.com/a/1233655) worked for me.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.