Jump to content

newlines plan text mail


digitalecartoons

Recommended Posts

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); 

}

Link to comment
https://forums.phpfreaks.com/topic/76192-newlines-plan-text-mail/
Share on other sites

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.