sotosk Posted April 13, 2011 Share Posted April 13, 2011 Hello! I have a problem on formatting text witch is being sent by mail. I use this code: $from = '<[email protected]>'; $to = '[email protected]'; $message = 'a b c'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= "From: $from" . "\r\n"; mail($to, $subject, $message, $headers); and I'm getting this mail: "a b c" I 've also tried this: $message = 'a'."\n".' b'."\n".' c'; but i got the same result. As you can see the problem is that i receive amessage that does not contains line brakes. I would be grateful for any kind of help! Link to comment https://forums.phpfreaks.com/topic/233621-php-mail-text-format/ Share on other sites More sharing options...
drisate Posted April 13, 2011 Share Posted April 13, 2011 use nl2br() mail($to, $subject, nl2br($message), $headers); or Use <br> to line break Link to comment https://forums.phpfreaks.com/topic/233621-php-mail-text-format/#findComment-1201202 Share on other sites More sharing options...
sotosk Posted April 13, 2011 Author Share Posted April 13, 2011 It works! 1000 thanks! Link to comment https://forums.phpfreaks.com/topic/233621-php-mail-text-format/#findComment-1201207 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.