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

From: Date: Thu, 26 Apr 2007 17:31:22 +0000
Subject: Re: Mail Factory - specify different MAIL FROM address to the From header
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27161@lists.php.net to get a copy of this message
On 4/26/07, Ben Wylie <pear@benwylie.co.uk> wrote:
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?
Hmmm...if there isn't a way to do it yet I'd say that perhaps it should be using the values in the authentication options if they're specified. Then again, perhaps it is done this way because a mail server won't allow you to do such a thing. A work-around may be to set the Reply-To header to what you want the "from" address to be. -- Justin Patrin

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