Re: Mail Factory - specify different MAIL FROM address to the From header
| From: | Ben Wylie | Date: | Thu, 26 Apr 2007 17:46:45 +0000 |
| Subject: | Re: Mail Factory - specify different MAIL FROM address to the From header | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-27162@lists.php.net to get a copy of this message | ||
Justin Patrin wrote:
On 4/26/07, Ben Wylie <pear@benwylie.co.uk> wrote:You're right about the work-around, I was wondering if it would be possible to do it the other way so it isn't so obvious. In fact a mailserver will allow you to do these things. Once you have authenticated yourself with a mail server, it will let you send an email to and from any address, so this shouldn't determine any of your headers or your MAIL FROM address. Google does it this way for gmail, so you can specify a different From: email address but it will put in the Sender: header specifying your gmail account and will use your gmail account in the MAIL FROM command. This way spam filtering mechanisms like SPF are still met, as the MAIL FROM address can be an address that is allowed to send an email from that server. If you are just sending emails out from any old address via my server, if the domains for these addresses specify their SMTP servers in SPF, the recipient may reject the email due to my ip address not matching the servers in their SPF record. It would be nice if you could do it like this: $mail_object->send($recipients, $mailfrom, $headers, $body); If the $mailfrom is not there, it uses the From header, but if it is there, it uses that address in the MAIL FROM command. Thanks BenI 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. <snip> 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.