The problem you are having took me a while to grasp. Basically, what
happens is that sendmail sends the mail as the user php/apache was
installed as (usually nobody@ or apache@ yourdomain.com).
Setting the Return-Path does not work, as you cannot override the
Return-Path set by the server in this way, that's why messages bounce to
your root account when sent with a php mail() function. If you only host
one domain on a server, you can fix this by editing the sendmail.cf file
and setting the Return-Path: to something more meaningful: However, most
people don't have the luxury of having a "one domain" hosting solution.

Your only other option is to invoke sendmail with the -f switch:
sendmail -f sender@address recipient@address <file_containing_message

This "forces" a from: address, but it also produces a warning to the
recipient that the message headers might be forged, but return mails and
replies are directed to the address specified.

Only problem with all this is that you need to do one of 2 things:
a) use of PHP's system commands eg.
$mail = `echo -e "Subject: Subject here\n\n Message here" |
/usr/sbin/sendmail -f $your_address $recipient_address`;

OR

b) use a PERL script to do it.

I am currently looking at both, and it seems at this stage that the PERL
script will be the better option, specially if you need to mail to alot
of people. You need to issue the sendmail in a loop, and for load
balancing, it's best to put a sleep() inside the loop; even if you only
make this a sleep(1) (sleep for 1 sec), PHP will timeout after only 30
recipients unless you override the default timeout setting for php
scripts.

On Tue, 2003-01-07 at 03:09, Peter Houchin wrote:
> richard check your php.ini & the mail stuff in there .. it's most likely
> using the address either there or ur web server config file
> 
> > -----Original Message-----
> > From: Richard Baskett [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, 7 January 2003 10:49 AM
> > To: PHP General
> > Subject: [PHP] PHP sendmail configuration
> >
> >
> > Ok I know it's off topic, but I've been working on this for over
> > 5 hours now
> > and I almost have it configured, but something is definitely wrong!
> > Basically I can send email using sendmail by this command:
> >
> > echo "Just a test" | mail -s "test" [EMAIL PROTECTED]
> >
> > Now [EMAIL PROTECTED] receives the email, but the From address is
> > [EMAIL PROTECTED] and I have no idea where it is getting that
> > address from!  Does anyone know how I can change that from address?
> >
> > And what would stop the above command from delivering to certain
> > valid email
> > addresses?
> >
> > This is definitely causing problems with my php server also when trying to
> > send emails...
> >
> > Rick
> >
> > "Only a life lived for others is worth living." - Albert Einstein
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

Reply via email to