Emails from PHP scripts have server's domain instead of clients.
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 username@serverhostname format, i want these email to be sent as from username@userdomain.
Can you point me to the right and safe solution to do this?
Thanks in advance
-
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. 0 -
Michael, can you please show us how to configure that (disallow non-SMTP auth relay or even block emails from cpanelusername@serverhostname) in Exim? 0 -
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. 0
Please sign in to leave a comment.
Comments
3 comments