chrispols Posted October 17, 2006 Share Posted October 17, 2006 Hi,I've been looking all around but can't find exactly how to fix adding line breaks into my automated mail. Can someone tell me what to do to modify this code to get line breaks in.<?php $to = $_POST['Email'];$subject = 'This is the subject';$message = 'Hello, this is an automated "\r\n" message <br> new line and text \r more line \r\n and another line';$headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion();mail($to, $subject, $message, $headers); ?>All I ever get is the actual \r \r\n "\r\n" in my mail.. Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/24181-line-breaks-mail-rn-not-working/ Share on other sites More sharing options...
chrispols Posted October 17, 2006 Author Share Posted October 17, 2006 Hi, found the problem.I had to change $message = 'Hello, this is an automated "\r\n" message new line and text \r more line \r\n and another line';to$message = "Hello, this is an automated \n\nmessage new line and text \r more line \r\n and another line";and it works.. just the double quotes.ThanksChris Link to comment https://forums.phpfreaks.com/topic/24181-line-breaks-mail-rn-not-working/#findComment-109910 Share on other sites More sharing options...
HuggieBear Posted October 17, 2006 Share Posted October 17, 2006 The reason for this is because everything between single-quotes is interpreted as a literal string, and not interpolated by php as it would be if it were enclosed in double-quotes.RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/24181-line-breaks-mail-rn-not-working/#findComment-109916 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.