Change forwarded email metadata

Dav987

Member
Jan 11, 2018
6
1
3
US
cPanel Access Level
Website Owner
I am looking to change the metadata of an email (specifically, the sender's address and subject) when it is forwarded to another account. It seems this is not a native function, but I assume I can accomplish this task by using a script, and just piping the messages to it. However, I have not idea how to actually make this work. I noticed on this thread: Email Forward to PHP Script a discussion on how to process email messages, so would I be starting with something like that? What would the actual manipulation script look like? What language should I even be using, PHP or pearl?

Thank you!
 

Dav987

Member
Jan 11, 2018
6
1
3
US
cPanel Access Level
Website Owner
Actually, I don't even really need to change the subject. Primarily, I need to change the sender information to protect their privacy.
 

Dav987

Member
Jan 11, 2018
6
1
3
US
cPanel Access Level
Website Owner
Also, I should apparently specify that the end goal is to push these messages to a single off-site email address. I know it sounds a little crazy, but I am not doing some spoof and spam operation, but just trying to permit one of three already known e-mail addresses (these could be hard-coded) send a message to a forwarder, which will strip out their own e-mail address and replace it with a generic one on the site, then forward it to a single external address (which could also be hard-coded). All of this is for a very specific privacy need.

I welcome any assistance--thank you!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Hello,

You could likely achieve this by piping the messages to a PHP script, but help with the coding of such a script isn't something we offer. You will likely find more help on a website such as StackOverflow. EX:

Email piping with php script

Of note, you may find the following option under the "Mail" tab in "WHM >> Exim Configuration Manager >> Basic Editor" useful:

Enable Sender Rewriting Scheme (SRS) Support

Per it's description:

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.
 
  • Like
Reactions: Dav987

Dav987

Member
Jan 11, 2018
6
1
3
US
cPanel Access Level
Website Owner
Hello,

You could likely achieve this by piping the messages to a PHP script, but help with the coding of such a script isn't something we offer. You will likely find more help on a website such as StackOverflow. EX:

Email piping with php script

Of note, you may find the following option under the "Mail" tab in "WHM >> Exim Configuration Manager >> Basic Editor" useful:

Enable Sender Rewriting Scheme (SRS) Support

Per it's description:

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.
That sounds very much like what I need at the bare minimum. However, I can't find it. For e-mail options, I have the following sections:
  • Email Accounts
  • Forwarders
  • Email Routing
  • Autoresponders
  • Default Address
  • Track Delivery
  • Global Email Filters
  • Email Filters
  • Authentication
  • Address Importer
  • Apache SpamAssassin™
  • Email Marketing
  • Encryption
  • Configure Greylisting
  • Calendars and Contacts
  • Email Disk Usage
Unfortunately, cpanel is being hosted by a 3rd party, so my options are somewhat limited. The first place I looked was under "forwarders" but found nothing of use (except for the option to set up or remove them). Any thoughts?

Thank you again for at least giving me something promising to work on!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Unfortunately, cpanel is being hosted by a 3rd party, so my options are somewhat limited. The first place I looked was under "forwarders" but found nothing of use (except for the option to set up or remove them). Any thoughts?
That option is available in Web Host Manager, and only accessible by your web hosting provider if your on a shared hosting plan. You could contact them to see if it's something they will consider enabling.

Thank you.
 
  • Like
Reactions: Dav987

Dav987

Member
Jan 11, 2018
6
1
3
US
cPanel Access Level
Website Owner
That option is available in Web Host Manager, and only accessible by your web hosting provider if your on a shared hosting plan. You could contact them to see if it's something they will consider enabling.

Thank you.
Thanks, I am already in contact with them, and they have not been very helpful. With what you have told me, and have been able to ask more directly about this specifically. I will seen see if it is a matter of ignorance or obstinance.

Again, thank you!
 
  • Like
Reactions: cPanelMichael

Dav987

Member
Jan 11, 2018
6
1
3
US
cPanel Access Level
Website Owner
Okay, they have refused to enable it "for security reasons." At least now I know that I need to find another provider. Thank you for your assistance!