how to change default sender address while using mail() function in PHP ?

navid120

Member
Apr 23, 2011
5
0
51
while I use mail() function to send emails, my sender address is a default address that I want to change it to some else like [email protected] , I think it must be in 'sendmail' file that I can not find . where can I find it or where is usr/bin/sendmail path?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello,

The default behavior of Exim is to use the cPanel username and hostname of the server to construct the envelope-sender address. Most applications that call the Exim/Sendmail binary will pass the -f switch along with the proper email address to keep that from happening.

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.