Php mail issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vinodkalpaka
Forum Newbie
Posts: 11
Joined: Thu Jun 02, 2005 1:11 am

Php mail issue

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Php mail issue

Post by requinix »

If you have a problem with the message part then how about you post the message part?
vinodkalpaka
Forum Newbie
Posts: 11
Joined: Thu Jun 02, 2005 1:11 am

Re: Php mail issue

Post 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 :-)
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: Php mail issue

Post 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.
vinodkalpaka
Forum Newbie
Posts: 11
Joined: Thu Jun 02, 2005 1:11 am

Re: Php mail issue

Post 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,
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: Php mail issue

Post by internet-solution »

internet-solution wrote:Which mail client do you use in your company?
Post Reply