I'm making a mail programm that wil be used to mail newsletters to customers, in the newsletters will be images and links. When I tested it on localhost everything worked fine and the links worked. However when I uploaded it to my website the links and image paths won't work anymore.
For some reason it adds %22 (which I found out are double quotes ") to the links and paths so the link I mailed looks like this:
/%22http//www.mywebsite.com/%22
And the image path looks like this:
%22http//www.mywebsite.com/content/someimage.jpg/%22
I'm using TinyMCE to edit the newsletter and I've tried relative_urls : false
and convert_urls : false
but that does nothing. I don't think this is a TinyMCE issue but I thought I'd mention it anyway.
I have no clue what is causing this so if anyone knows what it going on it would be great!
Update: I've checked my code and looked at the html of the text being send in the mail and there are no double quotes around the link at any time so my guess is that it is a server issue.
This is a problem with magic_quotes
Check your phpinfo() to see if it is turned off. If you are able to turn it off You have to disable it in your php.ini.
You can test if it's enabled or disabled with the following code:
<?php
echo "Magic quotes is ";
if (get_magic_quotes_gpc()) {
echo "enabled.";
} else {
echo "disabled";
}
?>
Another fix could be to use stripslashes()
to remove the slashes. This most likely will solve the problem.
Read the docs about stripslashes()
HERE
A quick example:
<?php
$str = "Is your name O\'reilly?";
// Outputs: Is your name O'reilly?
echo stripslashes($str);
?>
Edit: another thing you can try is to use html_entity_encode()
.
An example:
<?php
$orig = "I'll \"walk\" the <b>dog</b> now";
$a = htmlentities($orig);
$b = html_entity_decode($a);
echo $a; // I'll "walk" the <b>dog</b> now
echo $b; // I'll "walk" the <b>dog</b> now
?>
info HERE
Another SO answer. for html_entity_encode()
in urls
https://stackoverflow.com/a/10001006/1379394
If you have no access to your php.ini file,the easiest way could be adding this to your .htaccess file:
php_flag magic_quotes_gpc Off
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With