Can't set Reply-To Header in E-Mails sent via PHP mail()

Operating System & Version
CloudLinux 7.9
cPanel & WHM Version
11.102.0
Apr 28, 2022
3
0
1
Germany
cPanel Access Level
Root Administrator
Hi,

we're using CloudLinux 7.9 with cPanel and got the following problem.

Our test script:
Code:
$to        = '[email protected]';
$from      = '[email protected]';
$reply_to  = '[email protected]';
$betreff   = 'Der Betreff';
$nachricht = 'Hallo';

$header1 = '' .
    'From: ' . $from . "\r\n" .
    'Reply-To: ' . $reply_to . "\r\n" .
    'X-Mailer: ';

$header2 = '' .
    'From: ' . $from . "\r\n" .
    'X-Mailer: ';

mail($to, 'reply-to test', $nachricht, $header1);
mail($to, 'sendmail override respond-to test', $nachricht, $header2, '-f' . $reply_to);
After executing this script i'll get 2 E-Mails both containing a "Reply-To" field which is set to [email protected] and not [email protected].

We can't find any reference of this behaviour on Google and have no experts on Exim Config Reading.

We'll also supply any configs requested.

Thank you in advance.

HK Computerdienst GmbH
 
Last edited by a moderator:
Apr 28, 2022
3
0
1
Germany
cPanel Access Level
Root Administrator
I can asure you that this is not an error in the PHP code.

When you say, that cPanel may not be at fault, would you think that i should instead contact the CloudLinux support?

The script was just to confirm the behaviour but other software like Shopware or several Form Plug-Ins for different CMS show the same problem.

The Reply-To field gets overwritten by something in between the Code and leaving the Server.
 
Apr 28, 2022
3
0
1
Germany
cPanel Access Level
Root Administrator
I've found the link already but didn't think that any of this made a difference since the only real change we've made to exim was to configure a smart host to one of our SMTP servers.

I've also tried to send an email via the following code but got the same result. (Reply-To = From)

Code:
echo "This is message" | mail -s "Testing replyto" -S replyto="[email protected]" [email protected]
After clicking on "Answer" on the E-Mail the "To" Field was filled with [email protected] but should have been [email protected]

So this is not a PHP problem.

Regarding your Link, I'll gladly change any setting but i can't find a "trusted_users" in WHM Exim-Configurationmanager. Shouldn't the cPanel users already be trusted?

Edit: And regarding the external SMTP server, is set up to just receive emails and send them to their destination without changing anything about the email. There is no spam checking or anything done to the emails on this server. If i send an email from one of our other servers via this SMTP with a Reply-To header it stays intact.
 
Last edited: