php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #8301 Mail doesn't support -f
Submitted: 2000-12-17 10:28 UTC Modified: 2001-11-03 13:25 UTC
From: dirk at rackspace dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.3pl1 OS: Linux Redhat 6.2
Private report: No CVE-ID: None
 [2000-12-17 10:28 UTC] dirk at rackspace dot com
The current mail function /sendmail setting doesn't support the -f flag for sendmail. This means that when an email is sent out by a php script it doesn't bounce back to the from or reply-to address it bounces back to the web server.   In a virtual hosting situation this is a nightmare.

I wasn't sure how to handle all the regular expression stuff in c but I have a basic outline for the change needed in mail.c:

   if (strstr(senmail_path,"-f")!=NULL && (strstr(headers,"Reply-To:")!=NULL||strstr(headers,"From:")!=NULL))
    {
        int failure=0;
        /* They want to override
         * They have a valid header
         * Need to build up sendmail_path
         * First copy out the Reply-To: or From:
         * /
         
        if (strstr(headers,"Reply-To:")!=NULL)
        {
            /* Reply-To takes precidence */
	/* find out the reply-to address */
             }
        else if (strstr(headers,"From:")!=NULL)
        {
	/* find the From address */
        }

        if (no_match==1)
        {
            sendmail = popen(sendmail_path, "w");
        }
        else
        {
	/*copy the modify the sendmail path so that -f is overriden by -f  reply-to address or -f from_address */'
   sendmail = popen(new_sendmail_path, "w");
        }
    }
    else
    {
        sendmail = popen(sendmail_path, "w");
    }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-17 10:32 UTC] stas@php.net
You should use Errors-To and Return-Path headers, it'll help.
 [2001-11-03 13:25 UTC] mj@php.net
Since PHP 4.0.5 you can use the following syntax:

mail("user@example.org",
     "Subject",
     "Hello world!",
     "From: sender@example.com (My Name)",
     "-f sender@example.com");

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 11:01:28 2024 UTC