Re: mail function from and reply to address problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Lynch wrote:
On Thu, July 12, 2007 6:33 pm, Tanner Postert wrote:
I am currently running

PHP 5.1.4
Fedora Core 5

i'm trying to exectute the following test script.

<?php
$to      = 'my.email@xxxxxxxxxxx';
$subject = 'the subject';
$message = 'body';
$headers = 'From: webmaster@xxxxxxxxxx' . "\r\n" .
    'Reply-To: webmaster@xxxxxxxxxx' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

You really ought to be getting the return value from mail() and
checking it for success...

Error-checking is good. :-)

i have about 10 or so different virtual hosts running on this machine,
and
if i use any of them for the from & reply-to addresses, it works fine,
or
even if i use domains I don't control like aol.com or example.com
those work
too, but one particular new virtual host doesn't work, it re-writes
the from
address to the default virtual host address. which is strange because
that
isn't in the php.ini anywhere, but it could just be taking the
hostname.

anyone have any ideas?

As I understand it:

If the PHP (read: Apache) User is not "trusted" in sendmail config,
then sendmail won't let that user forge the return headers, and the
return comes from the default set in sendmail configuration.

Which is mentioned in the documentation:

http://www.php.net/manual/en/function.mail.php

;)

Sendmail and exim definitely have this sort of problem, I don't think postfix or qmail do though.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux