note 43683 deleted from function.mail by aidan
| From: | aidan@php.net | Date: | Mon, 14 Feb 2005 02:21:08 +0000 |
| Subject: | note 43683 deleted from function.mail by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84964@lists.php.net to get a copy of this message | ||
Note Submitter: phpnetnote at iamx dot nl
----
I had some trouble figuring out how to change the default Return-Path when a form was submitted and
mailed to a little program I run on my server that really needs a "real" Return-path.
Finally I came to this solution:
<?
ini_set(sendmail_from, $submitted_email);
mail("$reciever", "$subject", "$body",
"From: $submitted_email\\r\\n
Reply-to: $submitted_email\\r\\n
X-Mailer: A nice little mailer\\r\\n");
ini_restore(sendmail_from);
?>
What it does is temporarly set the Default sendmail_from email address to the submitted email
address and then after the mail action has been completed, it set's it back to the default that
has been assigned in the httpd.conf.
This is very efficient if you don't have root/conf access.