How to edit exim configuration so it do not reveal "Received: from" in headers?

postcd

Well-Known Member
Oct 22, 2010
717
19
68
Hello,

at cpanel server A i am executing a PHP script which is using cpanel server B SMTP to actualy send the e-mail.

and when i receive that e-mail and look into headers, i see the hostname and IP of the server on which is hosted that PHP script. I would like not to show this information in headers for the server A, only for server B.

I looked into cPanelWHM server B / Exim advanced configuration and tried to add thing like:

remote_smtp:
driver = smtp
headers_remove = Received \
x-uidl
into TRANSPORTSTART and TRANSPORTMIDLE textareas, but shows various errors.

Someone else also mentioned this:

remote_smtp:
driver = smtp
headers_remove = Received
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
but i have not tried as i look for advice from you if this is correct and where exactly add it in WHM exim advanced config page.

Please how to remove that "Received: from" from the headers of the e-mails that are sent on behalf of a remote server (server A), not via localhost (server B)? Maybe it is not good idea, i want this just for one e-mail sender domain/e-mail address. Thank You
 

postcd

Well-Known Member
Oct 22, 2010
717
19
68
Thx, the person in that topic added following into his exim configuration:
remote_smtp:
driver = smtp
headers_remove = Received
He mentions transport section of the exim conf.
I tried to add it into the transportstart and transportmiddle in Exim configuration editor / Advanced
but both failed at dry run with error: Exim configuration error: there are two transports called "remote_smtp"

and indeed, "remote_smtp" is visible in transport section, but i see no way to edit it in WHM / Exim configuration manager / Advanced.

Also i searched for "received_header_text" in Exim. conf. manager, but can not find it.
 

pincom_stu

Member
Oct 24, 2013
7
1
51
cPanel Access Level
Website Owner
Hi all,

I read through some of these older threads related to this issue, and just wanted to provide some more details on what I think is the best solution.

See here: How to Customize the Exim System Filter File | cPanel & WHM Documentation

I just verified it works and will not be overwritten by cPanel. It's a supported mechanism. Here's the example file file I have located under the directory /usr/local/cpanel/etc/exim/sysfilter/options:

# CUSTOM FILTER
if "${if def:header_X-PHP-Script: {there}}" is there
then
headers remove X-PHP-Script
endif

if "${if def:header_X-PHP-Originating-Script: {there}}" is there
then
headers remove X-PHP-Originating-Script
endif