Applicable to:
- Plesk 12.5 for Linux
- Plesk 11.x for Windows
- Plesk 11.x for Linux
- Plesk 12.0 for Windows
- Plesk 12.0 for Linux
Question
Default
Return-Path
for PHP mail script is taken as server administrator mail address.
How to specify exact default
Return-Path
for PHP mail scripts in Plesk?
Answer
As of now, the functionality of changing this setting via Plesk UI is not implemented.
As a workaround, according to PHP documentation, it is possible to re-define the values on a PHP level:
CONFIG_TEXT: Which "From:" mail address should be used in mail sent from PHP under Windows. This directive also sets the "Return-Path:" header.
This setting can be re-defined by adjusting corresponding php.ini file. For example:
- Log into Plesk.
- Go to Tools & Settings > PHP Settings > PHP 7.0 > php.ini and change
sendmail_from
to required mailbox:PLESK_INFO: sendmail_from = test@example.com
To re-define Return-Path
parameter for a particular domain, specify it in custom PHP settings for the domain at Domains > example.com > Websites & Domains > PHP Settings > Additional directives.
Authentication-results
parameter can be set by including in
php.ini
(for Linux, the default "From" field can be overridden for the outgoing emails):
CONFIG_TEXT: sendmail_path = "/usr/sbin/sendmail -t -i -f test@test.com"
Comments
2 comments
I am using Plesk 12.5 with qmail.
Plesk's habit of setting the Return-Path address to the Plesk customer addres, rather than just leaving it the same as From address, breaks DMARC checks.
changing sendmail_from or sendmail_path in php.ini, using the 4th parameter in php mail() does not work. Banged my head on this for quite some time by listening to articles like this from Plesk.
Plesk still overrides the Return Path
Here is a solution to remove Plesk's setting of the Return Path completely and let the Return Path = From email address.
# cd /var/qmail/bin
# cp sendmail sendmail-plesk
# vi sendmail-modified
[PHP]
#!/bin/bash
sendmail="/var/qmail/bin/sendmail-plesk"
newargs=""
flag=0
# loop through command line arguements
for var in "$@"
do
# if the flag is set
if [ $flag = 1 ]
then
# don't add the from email address
flag=0
continue
fi
# if we find a -f tag that sets Return-Path
if [ $var = "-f" ]
then
# don't add the -f parameter
flag=1
continue
fi
# if we got here, its a command line parameter we don't want to skip
newargs="$newargs $var"
done
# send the stdin and new args to sendmail-plesk
cat | $sendmail $newargs
[/PHP]
# chmod 750 sendmail-modified
# chown root.qmail sendmail-modified
# rm sendmail
# ln -s sendmail-modified sendmail
Hello, Mike K!
Thank you very much for your continuous efforts!
We really appreciate you sharing the knowledge with us.
Please sign in to leave a comment.