PHP: How to change email sender per directory (apache vhost)
I'm trying to find a *working* solution for changing the email sender for the php mail function running as a module on apache 2.0.x on a per directory/virtualhost basis.
Not sure if it matters, but the server has and uses xmail 1.23+
Running on RH9, with most stuff installed from sources, not RPM.
The page for the php mail function looks pretty helpful:
The code below will have to be fed the virtualhost name ($_SERVER['SERVER_NAME']) or the directory name ($_SERVER['PHP_SELF']) to decide what will go in the From field
$to = 'firstname.lastname@example.org';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: email@example.com' . "\r\n" .
'Reply-To: firstname.lastname@example.org' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
sorry for not mentioning this, just figured it was obvious: I need something that can be applied without changing the sources. I have quite a few sites with different scripts and if I go about changing sources, upgrading will be a pain.
|All times are GMT -5. The time now is 05:20 PM.|