Emails from PHP scripts have server's domain instead of clients.

cerberusgr

Registered
Sep 25, 2013
2
0
1
cPanel Access Level
Root Administrator
Hello,

Im trying some time now to resolve this issue, i have it since i setup the server, all emails sent by scripts that doesnt explicitly sets sender address given the [email protected] format, i want these email to be sent as from [email protected]

Can you point me to the right and safe solution to do this?

Thanks in advance
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)

The default behavior when sending email through PHP is to use the cPanel username and hostname of the server to construct the envelope-sender address. If you can configure the mailer to use SMTP and authenticate with SMTP AUTH, this will set the correct "Return-Path" in the headers. The other option is to make sure that the application is using the 5th argument to the PHP mail() function to send the '-f' switch to sendmail so that it sets the correct "Return-Path".

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
There are no options you can enable to force the use of SMTP authentication because the method used to send email is determined by how the script is coded. You will have to manually modify your PHP scripts to ensure they use SMTP authentication. If you want to block your PHP scripts from sending out email, you could ensure the mail function is disabled in your php.ini configuraton.

Thank you.