How to rewrite or modify the headers for forwarded emails

Philip Perez

Registered
Feb 1, 2016
4
0
1
Philippines
cPanel Access Level
Root Administrator
We want to rewrite or modify the headers of all incoming emails which are automatically forwarded to third party domains.

For example:
We have [email protected] which forwards all incoming emails to [email protected]

In this case, what we want to achieve is to rewrite the headers like the following:

FROM THIS:

From: [email protected] (or this could also come form the same domain)

To: [email protected] (we hope to apply also the same rule on cc and bcc mails)


Cc: [email protected], [email protected]

Subject: original subject


TO THIS:

From: "[email protected]" <[email protected]>

(or the string can be the name of the original sender if available instead of the email address)

To: [email protected]

Cc: [email protected], [email protected] (one question here is - will these send another email to these Cc email addresses or not?)

Reply-to: [email protected]

Subject: original subject

QUESTIONS:
1. Can we achieve this through Exim Configuration Manager in WHM?
2. Can we achieve this through Global Email Filters in CPANEL?
3. I've already read some threads about rewriting headers with exim filters from:

While Mail Forwarding with exim, how do I rewrite the To header with true destination address

Exim Specification - 33 Address rewriting

1. Forwarding and filtering in Exim

https://confluence2.cpanel.net/display/CKB/How+to+Customize+the+Exim+System+Filter+File

...but where should I really start? Which file should I create or modify. Which line should I insert my code? Should I use the exim file, .forward or .filter?


The main reason behind this is we are actually having issues forwarding incoming emails to third party addresses like gmail or yahoo. One of the common problems we are getting is the:

"Unauthenticated email from thirdpartydomian.com is not accepted due to domain's DMARC policy."

Even though we have a successful SPF and DKIM authentication in place.

And lastly, is this the a recommend approach to resolve the issue or there are other ways to resolve this?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,241
363
The main reason behind this is we are actually having issues forwarding incoming emails to third party addresses like gmail or yahoo. One of the common problems we are getting is the:

"Unauthenticated email from thirdpartydomian.com is not accepted due to domain's DMARC policy."

Even though we have a successful SPF and DKIM authentication in place.
Hello,

The following option under the "Mail" tab in "WHM >> Exim Configuration Manager >> Basic Editor" should address this problem:

Enable Sender Rewriting Scheme (SRS) Support

This option rewrites sender addresses so that the email appears to come from the forwarding mail server. This allows forwarded email to pass an SPF check on the receiving server.

Thank you.
 

Philip Perez

Registered
Feb 1, 2016
4
0
1
Philippines
cPanel Access Level
Root Administrator
Hello,

The following option under the "Mail" tab in "WHM >> Exim Configuration Manager >> Basic Editor" should address this problem:

Enable Sender Rewriting Scheme (SRS) Support

This option rewrites sender addresses so that the email appears to come from the forwarding mail server. This allows forwarded email to pass an SPF check on the receiving server.

Thank you.
Hi Michael,

I already enabled the SRS Support in my server. But it looks like nothing has changed in our headers.

Just like what I've said, we already have a successful SPF and DKIM in place, so whenever we are forwarding emails, our SPF and DKIM always gets a PASS result in the receiving server.

The main issue here is whenever we are forwarding emails coming from Yahoo! (with a very strict DMARC Policy Record "p=reject")
it is being considers as SPAM (with p=reject dis=none) or being rejected with this error:
"Unauthenticated email from yahoo.com (or gmail.com or linkedin.com and others) is not accepted due to domain's DMARC policy."

https://sendgrid.com/blog/yahoo-dmarc-update/

...in spite of getting a PASS in SPF and DKIM authentication.

GMAIL also moved to the same direction as Yahoo!

https://sendgrid.com/blog/gmail-dmarc-update-2016/

According to SendGrid, we should send the forwarded email with a "friendly from" address. How can we achieve this?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,241
363
I already enabled the SRS Support in my server. But it looks like nothing has changed in our headers.
Could you open a support ticket using the link in my signature so we can take a closer look at this? You can post the ticket number here so we can update this thread with the outcome.

Thank you.