digitalecartoons Posted November 6, 2007 Share Posted November 6, 2007 I'm having my flash form send it's data as plain text mail. When I enter a couple of paragraphs in the message field and receive the plain text mail, all paragraphs are put in a row instead that every paragraph starts at a new line. So I get this: Bericht: Dit is een nieuwe alineaDit zou op een nieuwe regel moeten beginnenDeze regel eigenlijk ook Instead of this: Bericht: Dit is een nieuwe alinea Dit zou op een nieuwe regel moeten beginnen Deze regel eigenlijk ook Can't use nl2br cause I'm using plain text mail, but what should I do to fix this? Actionscript: Versturen.onRelease = function() { mySendVars = new LoadVars(); myLoadVars = new LoadVars(); mySendVars.naam = naam.text; mySendVars.email = email.text; mySendVars.bericht = bericht.text; mySendVars.sendAndLoad("mailform.php", myLoadVars, "POST"); gotoAndStop(2); PHP code: $naam = stripslashes(utf8_decode($_POST["naam"])); $email = stripslashes(utf8_decode($_POST["email"])); $bericht = stripslashes(utf8_decode($_POST["bericht"])); $message = "Naam:\r\n".$naam."\r\n\r\n"; $message .= "Emailadres:\r\n".$email."\r\n\r\n"; $message .= "Bericht:\r\n".$bericht."\r\n"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $headers .= "From: ".mb_encode_mimeheader($naam, "iso-8859-1", "Q")." <".$email.">\r\n"; mail($to, $subject, $message, $headers); } Quote Link to comment Share on other sites More sharing options...
digitalecartoons Posted November 6, 2007 Author Share Posted November 6, 2007 I think it's because I've used stripslashes, but I've use that so that entered names like O'Brien don't appear as O\'Brien in the mail message. How can I fix this? Quote Link to comment Share on other sites More sharing options...
farkewie Posted November 6, 2007 Share Posted November 6, 2007 Try this, <?php $message = "Naam:\n $naam\n\n Emailadres:\n $email \n\n Bericht: \n $bericht \n"; ?> Quote Link to comment Share on other sites More sharing options...
digitalecartoons Posted November 6, 2007 Author Share Posted November 6, 2007 That doesn't work cause the newlines are allready replaced, think because of stripslashes. I want to have flash send a mail as plain text mail. Certain characters in the message part will be escaped. Magic quotes like ' will become \'. Zo normally, when I would submit a text like Mike O'Brien, it would appear as Mike O/'Brien in the plain text mail php sends. I want to get rid of that so I though of using stripsslashes. But that also erases things like newlines \n So it appears because when I send myself a text with several paragraphs, the plain text mail puts all those paragraphs behind each other insteas of beginning each paragraph on a new line. How should I do it otherwise? 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.