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
ShaolinF
Forum Newbie
Posts: 1 Joined: Tue May 15, 2007 1:29 am
Post
by ShaolinF » Tue May 15, 2007 1:37 am
I have a php script which sends out an email over an action. The problem is, when I add hyperlinks, I cannot use "\n" to make new lines and therefore all the text comes out on one line.
Code: Select all
<?
$to = "Someone <yourname@mysite.com>";
$subject = "You recieved a message!";
$headers = "From: Mysite <mysite@mysite.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "Reply-To: Mysite <mysite@mysite.com>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSmail-Priority: High\n";
$headers .= "X-mailer: My mailer";
//Content start
$message = "Thanks for your registration!\n";
$message = "___\n";
$message .= '<a href="http://www.mysite.com">www.mysite.com/editaccount.php?notifications</a>';
//Content end
mail ($to, $subject, $message, $headers)
?>
I've tried the following code too but when I run the script all my text dissapears and only the link remains:
Code: Select all
$message = '<a href="http://www.myurl.com">Link</a>';
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Tue May 15, 2007 2:06 am
pass your message through nl2br() or simply change your line breaks to <br> tags
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue May 15, 2007 8:29 am
The first two statements involving $message assignments are just that, assignments.