Question
How to specify the exact default Return-Path
for PHP mail() scripts in Plesk?
Answer
By default, Return-Path
includes the system user assigned to the domain that is executing the script with the function mail()
(i.e. [email protected] for user jdoe on the subscription example.com).
The functionality of changing this setting via Plesk UI is yet to be implemented. You may vote for such a possible feature on the UserVoice portal.
The top-ranked suggestions are likely to be included in the next versions of Plesk.
Some possible workarounds can be applied here:
For a particular script
<?php
$to = "[email protected]";
$subject = "Test email";
$txt = "Hello world!";
$headers = "MIME-Version: 1.0" . "rn";
$headers .= "Content-type:text/html;charset=UTF-8" . "rn";
$headers .= 'From: [email protected]' . "rn";
$headers .= 'Return-Path: [email protected]' . "rn";
mail($to,$subject,$txt,$headers, "-f [email protected]");
?>
For all scripts of a domain
-
Go to Domains > example.com > PHP Settings > Additional directives
-
Add a directive like the following:
sendmail_path = "/usr/sbin/sendmail -t -i -f [email protected]"
For all domains on one PHP version
-
Go to Tools & Settings > PHP Settings > PHP x.x > php.ini
-
Change the
sendmail_from
parameter to required mailbox:sendmail_from = [email protected]