Re: PHP's mail(): proper way to send a 'From' header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 7, 2008 at 2:06 PM, Dan Shirah <mrsquash2@xxxxxxxxx> wrote:
> You missed the period in your header to join the name and the line break??
>
> 'From: webmaster@xxxxxxxxxxx' . "\r\n"
> On 7/7/08, Jay Moore <jaymoore@xxxxxxxxxxxx> wrote:
>>
>> Greetings folks. I seem to be having a problem with PHP's mail() function
>> and sending 'From' headers properly. Here's my setup:
>>
>> I have a site I set up for a client that has a form their clients can fill
>> out to submit some data. When the form is submitted, I have PHP gather the
>> data and create the body of an email which is then sent to both the owners
>> of the site and back to the person who submitted the data. Because the
>> server hosts multiple sites, I am sending an additional 'From' header so the
>> email doesn't appear to come from the hostname of the server itself (
>> nobody@xxxxxxxxxxxxxx).
>>
>> Because I did not have a DNS entry for my hostname, the 'domain does not
>> exist' error I'm seeing in the bounce emails is correct. I do not wish to
>> keep a DNS entry for it (I have added one as a temporary fix), as that
>> doesn't fix the 'From' header issue to begin with, so I would appreciate it
>> if you did not make that suggestion.
>>
>> As per PHP's documentation of the mail() function, I am sending the header
>> like so:
>>
>> "From:  sender@xxxxxxxxxxxxx\r\n"
>>
>> I am getting bounce emails from certain ISPs (AOL, Roadrunner, some local
>> ISPs) saying the sender's domain does not exist. It seems that either mails
>> are coming from my hostname (nobody@xxxxxxxxxxxxxx), or those ISPs are
>> reading the additional headers incorrectly. Unfortunately, this is not
>> acceptable. People aren't getting their emails, and the hammer is coming
>> down on me.
>>
>> As far as I know (based on the lack of bounce emails), this worked fine on
>> PHP4, but with our new webserver (running PHP5), I'm experiencing problems.
>> Far as I can tell, the mail() function has not changed between versions.
>>
>> I'm stumped here and need to get this fixed asap. I've tried 'From' and
>> 'FROM', tried a 'Name Here <name@xxxxxxx>' format, and tried terminating
>> with double newlines with and without the carriage return. Nothing seems to
>> work. I've even gone so far as to edit php.ini with a default from address,
>> but that doesn't appear to have fixed anything either.
>>
>> Please help.
>>
>> Thanks in advance,
>> Jay
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

Dan,

His example would have worked since it was the entire thing surrounded
in quotes.


Jay,

Perhaps you can use the additional parameters to -f a return path
along with your header.  Whatever your current scripts domain is can
be set as the "-fexample@xxxxxxxxxxx" as long as you control the
domain (see SPF rules).  Maybe this will fix your issues?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux