php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #830 Make a 'from' parameter in the mail() function.
Submitted: 1998-10-07 11:06 UTC Modified: 1998-10-10 18:48 UTC
From: ca at kvl dot dk Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.5 OS:
Private report: No CVE-ID: None
 [1998-10-07 11:06 UTC] ca at kvl dot dk
I kindly suggest that you make a 'from' parameter in the mail function, like: mail($to,$from,...) or mail($to,...,$from) to comply with the current syntax. This will surely give the programmers more flexibility and it is required if you have the same PHP server running multiple sites with individual mailservers. Besides, it is syntactically more correct give the 'from' email-address in the parameter form rather than in the 'sendmail_from' parameter in the 'php3.ini' file, or even worse, having to modiffy this parameter manually prior to executing the mail()-function. 

Best,
Claus Andersson

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-10-10 18:48 UTC] jim
You can simply pass a From: header in the fourth parameter to mail() -- ie:

mail($to, $subject, $message, "From: me@there.com\nX-Mailer: PHP-Script/1.0");

You may need to tweak your sendmail configuration to allow this forging of the From: header,
but that would be true even if it were built-in to PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 07 11:01:28 2024 UTC