When redirected, received email from my server preserves the original "From: "
address, which isn't favorable since that address may (and usually do) have SPF protected domain, among other reasons.
This looks like:
a mail is sent from
[email protected]
to email address[email protected]
hosted at my server,a mail is delivered to
[email protected]
a mail is forwarded to
[email protected]
.otherdomain.tld
rejects the email since my server isn't eligible to send@gmail.com
emails.
How can I deal with this: can I rewrite "From: " address but only in case when email is redirected and according to some map?
It is a standard Virtualmin email setup with Postfix and /etc/aliases
.
virtual_alias_maps = hash:/etc/postfix/virtual
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
/etc/postfix/virtual
[email protected] name.domain
/etc/aliases
# See man 5 aliases for format
postmaster: root
clamav: root
name.domain: [email protected],\name.domain
Preserving the
From:
is not a problem since SPF checks are not done against theFrom:
header. In fact, it is a great idea not to touch theFrom:
header since emails from@gmail.com
usually have thisFrom:
header signed with DKIM.You need to rewrite the envelope sender, which you may see in the email headers as
Return-Path:
. This answer provides one possible solution to your problem. To quote it here: