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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.