Zend certified PHP/Magento developer

System emails are blocked using sSMTP

I have a home server with a dynamic IP (running Ubuntu 20.04.3) and want to receive the system mails to root as an email. I have set up sSMTP to send email via a Gmail account. Sending emails manually works. Automatically triggered emails caused by system events do not arrive. So I wonder about the difference between sending emails manually and the automatic email events caused by system events.

Here is my sSMTP configuration.

$ cat /etc/sSMTP/sSMTP.conf
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=mymail@web.de

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
rewriteDomain=gmail.com

# The full hostname
hostname=myhostname

# Are users allowed to set their own From: address?
FromLineOverride=YES

# Use SSL/TLS before starting negotiation
TLS_CA_FILE=/etc/ssl/certs/ca-certificates.crt
UseTLS=Yes
UseSTARTTLS=Yes

AuthUser=gmailuser@gmail.com
AuthPass=gmailpass

Sending emails works in principle. I receive emails correctly for all the following commands.

$ echo "Content" | mail -s "Subject" mymail@web.de
$ echo "Content" | mailx -s "Subject" mymail@web.de
$ echo -e "Subject: SubjectnnContent" | ssmtp mymail@web.de

However, if I trigger an automatic mail to root, things are different. For example, I intentionally give a wrong password for a sudo command.

$ sudo ls
[sudo] password for myuser: 
Sorry, try again.
[sudo] password for myuser: 
sudo: 1 incorrect password attempt

This issue triggers an email to mymail@web.de, but the email does not arrive. Instead, I get an email to gmailuser@gmail.com with the following error message.

554 Transaction failed Reject due to policy restrictions. For explanation visit https://web.de/email/senderguidelines?ip=209.85.221.44&c=hi

Here is the header:

Reporting-MTA: dns; googlemail.com
Received-From-MTA: dns; gmailuser@gmail.com
Arrival-Date: Wed, 25 Aug 2021 13:14:10 -0700 (PDT)
X-Original-Message-ID: <ID@mx.google.com>

Final-Recipient: rfc822; mymail@web.de
Action: failed
Status: 5.0.0
Remote-MTA: dns; mx-ha02.web.de. (212.227.17.8, the server for the domain web.de.)
Diagnostic-Code: smtp; 554-Transaction failed
 554-Reject due to policy restrictions.
 554 For explanation visit https://web.de/email/senderguidelines?ip=209.85.221.44&c=hi
Last-Attempt-Date: Wed, 25 Aug 2021 13:14:10 -0700 (PDT)

How can I find out the underlying command used by the automatic email events? And how can I change the automated email events to behave like the manual ones such that I receive the emails at mymail@web.de? Many thanks for any advice!