Re: "From" in mail() header problem. - Solved!

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

 



Ave,

On 5/18/05 10:55 AM, "Philip Hallstrom" <php@xxxxxxxxxxxxxxx> wrote:

> What happens if you do it like this:
> 
> $headers  = "Content-type: text/html; charset=iso-8859-1\r\n";
> $headers .= "From: SOMETHING <something@xxxxxxxxxxxxx>\r\n";
> $headers .= "Reply-To: myemail@xxxxxxxxxxxxx\r\n";
> $headers .= "MIME-Version: 1.0; X-Mailer: PHP/' . phpversion() . "\r\n";
> 
> mail($to,$subject,$message,$headers);
> 
> From the manual:
> 
> ----
> additional_headers (optional)
> 
> String to be inserted at the end of the email header.
> 
> This is typically used to add extra headers (From, Cc, and Bcc).
> Multiple extra headers should be separated with a CRLF (\r\n).
> 
> Note: If messages are not received, try using a LF (\n) only.
> Some poor quality Unix mail transfer agents replace LF by CRLF
> automatically (which leads to doubling CR if CRLF is used). This should
> be a last resort, as it does not comply with RFC 2822.
> ----

Believe it or faint, "\r\n" was the problem. I had actually tried it with
the way it was in the Manual to begin with, with the $headers in separate
lines, as you also suggested above, but it didn't work at all. And I know
that we don't re-write headers for outbound mail from the server because a
simple "From:" header without any additional headers works fine!

I ignored the last part that you mentioned when I had first read it in the
Manual.. But when you stated it in the response you sent, I did actually try
it out... Instead of using \r\n .. I used \n alone, and it worked!

I never had the problem of not receiving the email entirely at all though..
The recipient was definitely receiving the email being sent, contrary to
what is suggested by the manual.. And in fact everything except the "From:"
header was working fine. HTML format email with all the headers in tact were
being received using \r\n. But using \n alone, the "From:" is also fixed
now, and everything is working in order.

Thanks a ton!

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180

Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: rahul@xxxxxxxxxxxxxxxxxxxx
http://www.informed-sources.com

-- 
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