Skip to content Skip to sidebar Skip to footer

Slashes In Html Mail?

I'm trying to write an html mail sender but I have a problem, it shows slashes. Part of my code:

Solution 1:

Sounds like Magic Quotes are enabled: http://www.php.net/manual/en/security.magicquotes.php

Either disable Magic Quotes or do this:

$html = stripslashes($_REQUEST["html"]);

Also, if your script uses a from and to address from the form submission, you WILL be found by spammers who will send thousands of emails through your server until you are blocked by every spam blocker on the internet. You need to lock that down.

Any information you add to the mail header from a submission can be compromised, see this for more information: http://www.phpsecure.info/v2/article/MailHeadersInject.en.php

Solution 2:

Try using php functions to convert html. There are quite a few. You might need to encode, decode.

$html = htmlspecialchars($_REQUEST["html"]);

Solution 3:

Your PHP Settings are wrong, there's a setting like magic_quotes or someting, you have to disable this.

Solution 4:

this procedure worked for me:

$mail_message; //actual email message u want to send.$message= str_replace("\\n","<br/>",(stripslashes($mail_message)));
$message= str_replace("\\r","<br/>",$message);

Solution 5:

I fixed this by passing the text through stripslashes();

It's not (or no longer, anyway) caused by magic_quotes, as that was removed in PHP 5.4. PHP seems to automatically add slashes to text that comes from HTML forms, as (maybe?) a security measure.

Post a Comment for "Slashes In Html Mail?"