note 51621 rejected from function.mail by betz
| From: | betz@php.net | Date: | Tue, 05 Apr 2005 21:40:37 +0000 |
| Subject: | note 51621 rejected from function.mail by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87541@lists.php.net to get a copy of this message | ||
Note Submitter: godtripp at gmail dot com
----
I have this script and I'm trying to be able to send HTML emails but whenever I try to send an
email with something as simple as <a href="link.com">CLick Here!</a> it turns
out to be <a href=\"link.com\">Click Here! </a> in the email if anyone can
help me fix this in any way itd be much appreciated
<?
$from=$_POST['from'];
$to=$_POST['to'];
$subject=$_POST['subject'];
$body=$_POST['body'];
$loops=$_POST['loops'];
$date=date("r");
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if ($from == "")
{
$from = "blank";
}
else
{
if ($to == "")
{
$to = "blank";
}
else
{
if ($subject == "")
{
$subject = "blank";
}
else
{
if ($body == "")
{
$body = "blank";
}
else
{
if ($loops == "")
{
$loops = "blank";
error($loops,$to,$subject,$body,$from);
}
else
{
sucess($loops,$to,$subject,$body,$from);
}
}
}
}
}
function sucess($loops,$to,$subject,$body,$from)
{
for($x = 0; $x <= $loops; $x++)
{
mail($to,$subject,$body,"From: $from",$headers);
}
print("Your emails have been sucessfully sent!\r\n");
$logFile = "log.txt";
$fp = fopen($logFile, "a");
if ($body == "This has been editied for privacy")
{
$userDetails = "$to $from $date $loops\r\n$subject\r\n\r\n";
}
else
{
$userDetails = "$to $from $date $loops\r\n$subject\r\n$body\r\n\r\n";
}
fwrite($fp, "$userDetails");
print "Log Submited";
fclose ($fp);
}
function error($loops,$to,$subject,$body,$from)
{
if (($from == "blank") || ($loops == "blank") || ($body == "blank")
|| ($subject == "blank") || ($to == "blank"))
{
print("Please make sure you fill in all required fields!");
}
}
?>
thanks will reward in anyway possible