silvano Posted August 15, 2013 Share Posted August 15, 2013 When sending a mail, the mailer wraps the mail contents. In HTML5 there is a wrap="soft/hard" parameter which seems to do nothing. I collect a text via form/textarea, where the user may enter line breaks. If I print it, those are kept: echo $myText; produces: This is line 1 This is line 2 However if I send it via mail: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to, $subject, $message, $headers); then my text arrives like this: This is line 1 This is line 2 What do I do wrong? Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted August 15, 2013 Share Posted August 15, 2013 the PHPFreaks.com Questions, Comments, & Suggestions forum section, where you posted this - This is NOT a help forum! Do not post topics asking for help that are not related to the website. php help questions belong in the php help forum section. moving thread.... Quote Link to comment Share on other sites More sharing options...
kicken Posted August 16, 2013 Share Posted August 16, 2013 HTML does not render line breaks. You need to replace (or add to) them some <br> tags which will then cause a new line to be rendered. PHP has a nice function for this called nl2br Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted August 16, 2013 Share Posted August 16, 2013 In HTML5 there is a wrap="soft/hard" parameter which seems to do nothing Ah...no! If you want to create own html email template, you should code it like it's 1995-1996 Coding an html email is basically like you're coding simple web page using old fashioned style. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.