How to specify default Return-Path for PHP mail script

Refers to:

  • Plesk 12.5 for Linux
  • Plesk 11.5 for Windows
  • Plesk 11.5 for Linux
  • Plesk 12.0 for Windows
  • Plesk 12.0 for Linux

Created:

2016-11-16 13:16:43 UTC

Modified:

2016-12-21 20:20:53 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to specify default Return-Path for PHP mail script

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 Script?

Answer

According to PHP documentation:

     sendmail_from

Which "From:" mail address should be used in mail sent from PHP under Windows. This directive also sets the "Return-Path:" header.

It can be defined server-wide.PHP mail() function takes Return-Path value from the parameter sendmail_from defined in server php.ini .

  • For Linux:

    grep sendmail_from `/etc/php.ini`
    sendmail_from = test@example.com
  • For Windows:

        type "%plesk_dir%Additional\\PleskPHP5\\php.ini" | findstr sendmail_from
    ;sendmail_from = me@example.com
    sendmail_from = test@example.com

To define Return-Path parameter for a particular domain, specify it in custom PHP settings for the domain:

   **Home > Domains > example.com > Websites & Domains > PHP Settings > Additional directives**

The parameter can be defined as in the example below:

sendmail_from = test@example.com

Authentication-results parameter can be set by including in php.ini (for Linux, the default "From" field can be overriden for the outgoing emails):

sendmail_path = "/usr/sbin/sendmail -t -i -ftest@test.com"
Have more questions? Submit a request
Please sign in to leave a comment.