Link to home
Start Free TrialLog in
Avatar of star6868
star6868

asked on

How to put End of Line with PHP - Sendmail ?

I use mail() function of PHP to send mail to GMAIL, YAHOO...
I put <br> for End of Line
But when I view gmail, yahoo mail, The tag <br> is not change, not indicate End of line!

This is the code:

<?php

$to      = "my_gmail_acount@gmail.com";
$subject = ' Wellcome to sendmail of PHP !';
$message = '     This is line 1';
$message.= ' <br>this is Line 2 ';
$message.= ' <br>this is Line 3 ';
$headers = 'From: admin@mydomain.com' . "\r\n".
      'Reply-To: admin@mydomain.com' . "\r\n";

mail($to,$subject,$message,$headers,"-f admin@mydomain.com");  

?>

How can I resolve this problem?
Thanks in advanced!
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

you might want to try to use \n in addition to


<?php 
$to      = "my_gmail_acount@gmail.com";
$subject = ' Wellcome to sendmail of PHP !';
$message = '     This is line 1';
$message.= ' <br/>\nthis is Line 2 ';
$message.= ' <br/>\nthis is Line 3 ';
$headers = 'From: admin@mydomain.com' . "\r\n".
      'Reply-To: admin@mydomain.com' . "\r\n"; 
mail($to,$subject,$message,$headers,"-f admin@mydomain.com");   
?>

Open in new window

Use \n as angellll suggests, and REMOVE the <br/>. The latter is a html element, you are not sending an html email.
ASKER CERTIFIED SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial