Page 1 of 1

Php mail issue

Posted: Thu Jun 17, 2010 12:50 am
by vinodkalpaka
Hi,

I have been stuck with an issue related to mail in php. Following is the code that I have used. In the message part I want to use line breaks. For that first I have tried with <br />. Then it was ok with gmail, yahoo such mails. But not with my company id. It is looking as such as the html part in message.

Then I have tried with \n. Then the reverse happened. Working well with my company id but not with gmail and yahoo etc. Expecting a solution for this problem as early as possible.

$headers = "From: test@test.org\r\n";

$headers .= "Return-Path: test@test.org\r\n";

$headers .= "Return-Receipt-To: test@test.org\r\n";

$headers .= "MIME-Version: 1.0\r\n";

$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";

$headers .= "Message-ID: <".time()."-test@test.org>\r\n";

$headers .= "X-Mailer: PHP v".phpversion()."\r\n";

$bounceString = '-f test@test.org';

ini_set("SMTP","localhost");

ini_set("smtp_port","25");

ini_set("sendmail_from","me@localhost.org");
@mail ("$email","$subject","$message","$headers");

Thanks

Re: Php mail issue

Posted: Thu Jun 17, 2010 1:24 am
by requinix
If you have a problem with the message part then how about you post the message part?

Re: Php mail issue

Posted: Thu Jun 17, 2010 2:32 am
by vinodkalpaka
$message = "Hi ".$fullname.",<br />

This email has been sent so you can activate your account.<br />

To do this just click on the link below or copy and paste the URL into your browser.<br />

".$siteurl."member_verification.php?member=".$memberId.

"Many thanks<br />

Admin";


Sorry :-(...this is the message part. <br> is showing in id othr than gmail, yahoo etc..

Hoping for the best :-)

Re: Php mail issue

Posted: Thu Jun 17, 2010 6:46 am
by internet-solution
Which mail client do you use in your company? It seems that client does not understand HTML tags.

Since you are not using any fancy font color or style one work around can be to change Content-Type to 'text/palin' and then use \r\n as line break. It should work on all mail clients.

Re: Php mail issue

Posted: Thu Jun 17, 2010 11:22 pm
by vinodkalpaka
Hi,

Thanks for your reply.
But if we are using text/plain then it wont accept href
Anchor tag is also there in my message.
Please give me a solution for that

Thanks,

Re: Php mail issue

Posted: Fri Jun 18, 2010 5:06 am
by internet-solution
internet-solution wrote:Which mail client do you use in your company?