I have an unbuntu server using sendmail
and postfix
to send apticron
, cron
etc emails.
postfix
is configured to use a smart relay, the smart relay is rejecting emails as they come from the subdomain of the server rather than the domain.
So, I have a server called backup
on mydomain.com
emails were set with a From:
header of backup.mydomain.com
and our relay is only configured to allow emails from mydomain.com
. I don't want to change this.
So in postfix
's main.cf
I added masquerade_domains
for mydomain.com
, which if I'd read the [docs][1] right would mean that backup
would be stripped out of the from to result in emails From: [email protected]
coming as From: [email protected]
However, I am now getting emails From: root@backup
main.cf
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = backup.mydomain.com
masquerade_domains = mydomain.com
mydomain = mydomain.com
myorigin = $mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, backup.mydomain.com, backup, localhost.localdomain, localhost
Suggestions appreciated. I've seen various other posts with complex changes to sendmail
and other solutions, but, they don't seem right as I'm just trying to get the email to be from [email protected]
for a named server in the domain, which I understand to be a postfix
concern and masquerade_domains
seems to be the documented solution.
[1]: http://www.postfix.org/postconf.5.html#masquerade_domains