> I have an issue with sending email via PHP which may be a configuration 
> problem with either PHP, Apache, or possibly a Sendmail, but I don't know 
> which yet.  I figured I'd start here first.
> 
> Here's the situation.  I have several webpages that send email to users for 
> various reasons.  We have our webserver, an intranet webserver, configured to 
> connect to our smtp server which sits on a different box. The script looks 
> like this:
> 
> <?PHP
> $from = "[EMAIL PROTECTED]";
> $to = "[EMAIL PROTECTED]";
> $subject = "Test";
> $msg = "This is a test from my sitennTimestamp: " . date("r");
> $headers = "From:$fromrn";
> if(!mail($to,$subject,$msg,$headers)) { die("Unable to send"); }
> ?>
> 
> This works great when it works. Users receive email as expected and when they 
> hit reply it goes back to the webmaster email address.  The problem is if the 
> to email address isn't a valid one.  When this happens, the mail server 
> bounces the message back to [EMAIL PROTECTED] instead of [EMAIL PROTECTED]
> 
> I've tried adding reply-to to the mail headers and that doesn't work either.  
> We tried sending the same failed message using webmin and that worked great, 
> which is why I believe this to be a PHP or Apache problem.



Is it a UNIX box?  Sendmail takes the -f parameter in your php.ini to configure 
its envelope from address... Does not extract it from message headers.  The 
fifth argument to mail() also supports doing this if you need to change it on a 
per-mail basis.  I would just set it in php.ini. (like: sendmail_path = 
'/usr/bin/sendmail -f [EMAIL PROTECTED]')

If its a Win box there is a sendmail_from config param in php.ini.

php.net/manual/function.mail.php read for 'Additional Params' the fifth 
argument, it specifically deals with this case.

Travis

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

Reply via email to