Hi All,
I am facing strange problem right now in my server. I have php 5 installed with all needed rpms in linux server.
I am using the mail() with following code.
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: email@email.com \r\n";
$headers .= "Bcc: email@email.com \r\n";
$message = "test";
mail("email@email.com","email@email.com",$message,$headers);
Now the message comes in html code. In yahoo mail account the mail is going with html tags applied properly but in gmail and other few mail account, it is going without taking any effect and all tags are just showing.
They are coming like
Content-type: text/html; charset=iso-8859-1
From: email@email.com
<font face=Verdana, Arial, Helvetica, sans-serif size=1><b>test<b></font>
in gmail
but in yahoo it is coming properly,
test
Can anyone help me out of this problem?
Mark.
php mail() problem
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: php mail() problem
Have you read the PHP manual for the mail() function? There is an example for HTML email.
(#10850)
Re: php mail() problem
Hi ,
I removed only '\r' from the code and it started working like a dream. Now this is weired i think.
Why \r was working perfactly in old server and in new dedicated server it was not working??
Is it php 4 and php 5 problem or is it server security problem?
Please let me know for the reason as \r\n combination is in php manual and if it does not work then there must be some big change.
Thanks again.
I removed only '\r' from the code and it started working like a dream. Now this is weired i think.
Why \r was working perfactly in old server and in new dedicated server it was not working??
Is it php 4 and php 5 problem or is it server security problem?
Please let me know for the reason as \r\n combination is in php manual and if it does not work then there must be some big change.
Thanks again.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: php mail() problem
I think it should be "\r\n". I don't know why PHP5 would want only "\n"???
(#10850)