The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to rewrite or modify the headers for forwarded emails

Discussion in 'E-mail Discussions' started by Philip Perez, Aug 31, 2016.

  1. Philip Perez

    Philip Perez Registered

    Joined:
    Feb 1, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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 user1@ourdomain.com which forwards all incoming emails to user1@gmail.com

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

    FROM THIS:

    From: originalsender@thirdparty.com (or this could also come form the same domain)

    To: user1@ourdomain.com (we hope to apply also the same rule on cc and bcc mails)


    Cc: user2@ourdomain, others@thirdparty.com

    Subject: original subject


    TO THIS:

    From: "originalsender@thirdparty.com" <user1@ourdomain.com>

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

    To: user1@gmail.com

    Cc: user2@ourdomain, others@thirdparty.com (one question here is - will these send another email to these Cc email addresses or not?)

    Reply-to: originalsender@thirdparty.com

    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?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    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.
     
  3. Philip Perez

    Philip Perez Registered

    Joined:
    Feb 1, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Philippines
    cPanel Access Level:
    Root Administrator
    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?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  5. Philip Perez

    Philip Perez Registered

    Joined:
    Feb 1, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Philippines
    cPanel Access Level:
    Root Administrator
    Hi! I created a support ticket with Support Request ID No. 7659171

    Thank you for your advice.
     
Loading...

Share This Page