Skip to content

$Conf{EMailFromUserName} is overridden by "auto_from on" in /etc/msmtprc #27

@toggoboge

Description

@toggoboge

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, [email protected], for use by the SMTP relay container. The Gmail account has also been setup with an alias, [email protected], and emails sent by a small python script from this address via my local SMTP relay are successfully received as coming from [email protected].

In the backuppc container, I have set $Conf{EMailFromUserName} to [email protected].

When I try to send a test email to [email protected] from inside the container, I see the following:

bash-5.0$ /usr/local/BackupPC/bin/BackupPC_sendEmail -u [email protected]
Sending test email using /usr/sbin/sendmail -t -f [email protected]

This successfully sends emails via my local SMTP relay. However, the mails are always received as coming from [email protected].

In spite of [email protected] being used on the sendmail command-line, I see the following in the headers:

From: [email protected]
X-Google-Original-From: [email protected]

Gmail is not honouring the from-address because [email protected] has permission to send emails from [email protected], but not from [email protected].

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 [email protected] is used as the from-address instead of [email protected].

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 [email protected] with the from-address is correctly set to [email protected].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions