Mateobus Posted September 27, 2006 Share Posted September 27, 2006 I want to send a dynamic email, the only problem that I am having is that the line breaks won't work? Does anyone know how to put a line break in an email body? Here is my code:$email = "[email protected]";$subject = "Hey";$body = "Dear Person,\nHow are you?";echo "<a href=\"mailto:$email?subject=$subject&body=$body\">";Everything is working except my email client isn't recognizing the line break (\n). I tried html (<br />) as well and that didn't work. Any help is appreciated. Link to comment https://forums.phpfreaks.com/topic/22276-line-breaks-in-emails/ Share on other sites More sharing options...
kenrbnsn Posted September 27, 2006 Share Posted September 27, 2006 Try using "\r\n" instead of just "\n".Ken Link to comment https://forums.phpfreaks.com/topic/22276-line-breaks-in-emails/#findComment-99742 Share on other sites More sharing options...
Mateobus Posted September 27, 2006 Author Share Posted September 27, 2006 Ken,I tried that with no success. Here is the problem, since the string is enclosed by double quotes, it is interpreting the line breaks and carriage returns before it ever gets to the email client. So I think I want literal characters (single quotes) to be sent to the email client. This still doesn't work though because it shows up as \n in my email client. Thank you for your help.Matt Link to comment https://forums.phpfreaks.com/topic/22276-line-breaks-in-emails/#findComment-99753 Share on other sites More sharing options...
phporcaffeine Posted September 27, 2006 Share Posted September 27, 2006 While the above should work no matter what app you are using to write code ... I have seen in some IDE 's where the IDE will insert it's own type of line break in your code.Then it gets passed in your script without your knowledge. The way you can test this is; open the script in your IDE and just put some IDE line spacing where you would want the line break. If it works then you know what/where you problem is.To fix it you'll need a different IDE or find the option in your IDE to turn off the auto line spacing. Link to comment https://forums.phpfreaks.com/topic/22276-line-breaks-in-emails/#findComment-99756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.