I have this mail script, and I have no problem whatsoever delivering it to other domains. The only problem I have is that whenever I put an apostrophe (') or single quote it turns like \'. For example I put "Tom's World" on the subject... The output would become "Tom\'s World". Any help would be appreciated, thanks!
For simplicity sake, I've ommited some of the variables I've used... Here's the code...
Code: Select all
function escape_data($data)
{
if (get_magic_quotes_gpc()) //magic quotes is on
{
$data = stripslashes($data);
}
if (!is_numeric($data))
{
$data = mysql_real_escape_string($data);
}
return $data;
}
if(empty($_POSTї'subject']))
{
$s=false;
$errmessage.='<p>Please enter a <b>subject</b>.</p>';
}
else
{
$s=$_POSTї'subject']; //escape_data($_POSTї'subject']);
}
if(empty($_POSTї'message']))
{
$m=false;
$errmessage.='<p>Please enter a <b>message</b>.</p>';
}
else
{
$m="e;Message sent from http://mydomain.com\n\n"e;;
$m.= $_POSTї'message']; //escape_data($_POSTї'message'])
}
if ($n && $s && $e && $m)
{
ini_set("e;SMTP"e;,"e;localhost"e;);
ini_set("e;smtp_port"e;,"e;26"e;);
ini_set("e;sendmail_from"e;,"e;admin@localhost.com"e;);
$headers = "e;MIME-Version: 1.0\n"e;;
$headers .= "e;Content-type: text/plain; charset=iso-8859-1\n"e;;
$headers .= "e;X-Priority: 3\n"e;;
$headers .= "e;X-MSMail-Priority: Normal\n"e;;
$headers .= "e;X-Mailer: php\n"e;;
$headers .= "e;From: \"e;"e;.$n."e;\"e; <"e;.$e."e;>\n"e;;
if (mail("e;somemail@domain.com"e;,$s,$m,$headers))
{
$message.="e;<center><p>Success!</p></center>"e;;
}
else
{
$message.="e;<center><p>The following errors occured!</p></center>"e;;
$errmessage.='<p>Unable to send message.</p>';
}
}
else
{
$message.="e;<center><p>The following errors occured!</p></center>"e;;
}
}Code: Select all
tags when posting php code. Review [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]