-
Notifications
You must be signed in to change notification settings - Fork 49
Description
I am running the BackupPC v4.3.1 version of the container.
BTW, below I have obscured my domain as 'mydomain.com'.
$Conf{EMailFromUserName} is overridden by "auto_from on" in /etc/msmtprc, meaning the configured from-address is not used in outgoing emails.
Using SMTP_HOST & SMTP_MAIL_DOMAIN environment variables, I have configured the backuppc container to send emails via a local SMTP relay container (docker pull namshi/smtp).
I've created a Gmail account, mailrelay@mydomain.com, for use by the SMTP relay container. The Gmail account has also been setup with an alias, backuppc-server@mydomain.com, and emails sent by a small python script from this address via my local SMTP relay are successfully received as coming from backuppc-server@mydomain.com.
In the backuppc container, I have set $Conf{EMailFromUserName} to backuppc-server@mydomain.com.
When I try to send a test email to backuppc@mydomain.com from inside the container, I see the following:
bash-5.0$ /usr/local/BackupPC/bin/BackupPC_sendEmail -u backuppc@mydomain.com
Sending test email using /usr/sbin/sendmail -t -f backuppc-server@mydomain.com
This successfully sends emails via my local SMTP relay. However, the mails are always received as coming from mailrelay@mydomain.com.
In spite of backuppc-server@mydomain.com being used on the sendmail command-line, I see the following in the headers:
From: mailrelay@mydomain.com
X-Google-Original-From: backuppc@mydomain.com
Gmail is not honouring the from-address because mailrelay@mydomain.com has permission to send emails from backuppc-server@mydomain.com, but not from backuppc@mydomain.com.
I think this is happening because the "auto_from on" setting in /etc/msmtprc is causing msmtp to generate the from-address from the Linux username, 'backuppc' in this case. This causes the configured $Conf{EMailFromUserName} to be overridden, and backuppc@mydomain.com is used as the from-address instead of backuppc-server@mydomain.com.
Manually changing "auto_from on" to "auto_from off" in /etc/msmtprc has fixed this for me (at least for test emails - I haven't yet checked other emails auto-sent by BackupPC), and the test email sent by the BackupPC_sendEmail command above, is now received by backuppc@mydomain.com with the from-address is correctly set to backuppc-server@mydomain.com.