Solved

How to put End of Line with PHP - Sendmail ?

Posted on 2008-10-12
3
290 Views
Last Modified: 2008-10-13
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!
0
Comment
Question by:star6868
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22696984
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

0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 22696990
Use \n as angellll suggests, and REMOVE the <br/>. The latter is a html element, you are not sending an html email.
0
 
LVL 39

Accepted Solution

by:
Roger Baklund earned 250 total points
ID: 22696994
Also, the \n must be within double quotes:
<?php 
$to      = "my_gmail_acount@gmail.com";
$subject = ' Wellcome to sendmail of PHP !';
$message = "     This is line 1\n";
$message.= "this is Line 2\n";
$message.= "this is Line 3\n";
$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

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question