Mail Factory - specify different MAIL FROM address to the From header

From: Date: Thu, 26 Apr 2007 17:29:10 +0000
Subject: Mail Factory - specify different MAIL FROM address to the From header
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27160@lists.php.net to get a copy of this message
I am using PEAR's Mail::Factory to send an email from a feedback form on my website. I am getting it to send an email via my mail server, using smtp authentication. I would like to send an email with the following headers: From: To: Subject: Sender: I would like the From address to be user defined, via a form they fill out, however, when the email is actually sent, I would like it to use a different address for the MAIL FROM command. So for example: A user fills out a web form from the address: webuser@hotmail.tld I would like the headers to be: From: webuser@hotmail.tld To: destination@gmail.tld Subject: Website Feedback Sender: phpuser@mydomain.tld I would like the email to be sent with the command: MAIL FROM:<phpuser@mydomain.tld> On this info page: http://pear.php.net/manual/en/package.mail.mail.send.php in the example it says to use: $mail_object->send($recipients, $headers, $body); So when you send the email, there doesn't seem to be a way to specify the MAIL FROM command, it must take it directly out of the headers you give it - ie from the From: Header. Is there a way in which I can specify a MAIL FROM address which is different from the From address in the headers? Thanks for your help, Ben

« previous php.pear.general (#27160) next »