note 51621 added to function.mail

From: Date: Tue, 05 Apr 2005 21:10:22 +0000
Subject: note 51621 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-87536@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.mail.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51621 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51621&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51621&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51621&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51621&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51621&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51621&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87536) next »