Trying to get new line on sms message sent from php script

Viewed 56953

I've been trying to get a new line generated in my SMS message sent from a PHP script. I've used \r\n, <BR> and some hex codes. No matter what I do the message comes to my phone without line breaks.

$body .= 'City:'.$venue.'\r\n'; //<- doesn't work
$body .= 'State:'.$state.'<br>'; //<- doesn't work

This is my header type...(complete header not included)

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

I use mail to send...

mail($somenumber,$subject,$body,$headers)

Everything works fine in the sense that I receive the message. I hope that I'm missing something, because this is driving me crazy.

14 Answers

for me sometimes %0a works and sometimes \n works depends on the SMS gateway

Had same problem, this works for me.

$text .= chr(10) . 'hello world'; But all other answer didn't when i tested.

This worked for me in php,

$message = "Welcome,
some text
Thank you for choosing us.";
Related