- Plesk for Linux
What is the return path/sender in PHP mail() scripts?
How to change 'from' field?
By default, the system user assigned to the domain that is executing it is used.
The return path would be [email protected] for the following:
User assigned: testuser
For a particular script:
If a different email address is wanted to be the return path and/or sender, it can be customized in the headers, for example:
$to = "[email protected]";
$subject = "Test email";
$txt = "Hello world!";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: [email protected]' . "\r\n";
$headers .= 'Return-Path: [email protected]' . "\r\n";
mail($to,$subject,$txt,$headers, "-f [email protected]");
For all scripts of domain:
Go to Domains > example.com > PHP Settings > Additional directives and add a directive like the following:
CONFIG_TEXT: sendmail_path = "/usr/sbin/sendmail -t -i -f [email protected]"