|
Posted by Dormouse on 07/21/07 03:29
Hi just a newbie @ php; have been tweaking a mail script I found on the 'net
to send server-side from a secure site (https).
I've tweaked the content-headers successfully to allow me to embed html
coding in the message body.
the two problems I can't seem to work around are these:
1) I get TWO identical copies of my mail instead of the desired ONE
2) I can't seem to get the script to send a carbon-copy (Cc)
I created a form input field on my mail form with the name attrib set to
"Cc" - which I hoped would return a value for $_POST['Cc'].
I've pasted the PHP from the form processor below, if anyone can help, I'd
much appreciate...
============== BEGIN FORM ===================
<?php
/* recipients */
$to1 = $_POST['to'];
$Cc1 = $_POST['Cc'];
/* message */
$name1 = $_POST['name'];
$from1 = $_POST['from'];
$website1 = $_POST['website'];
$messagebody1= $_POST['messagebody'];
$messagebody1= str_replace("\\\\","",$messagebody1);
$messagebody1= str_replace("\'","'",$messagebody1);
$messagebody1= str_replace("\\\"","\"",$messagebody1);
$message1 .= $messagebody1."\r\n";
$subject1 = "Mail from $name1";
/* To send HTML mail, you can set the Content-type header. */
$headers1 = "MIME-Version: 1.0\n";
$headers1 .= "Content-type: text/html; charset=iso-8859-1\n";
$headers1 .= "X-Priority: 3\n";
$headers1 .= "X-MSMail-Priority: Normal\n";
$headers1 .= "X-Mailer: PHP/"."MIME-Version: 1.0\n";
$headers1 .= "From: $myname <$myemail>\n";
/* additional headers */
$headers1 .= "To: ".$to1."\r\n";
$headers1 .= "From: ".$from1."\r\n";
$headers1 .= "Reply-To: ".$from1."\r\n";
$headers1 .= "Cc: \r\n";
/*echo($to1."<br>");
echo($subject1."<br>");
echo($message1."<br>");
echo($headers1."<br>");
*/
$ref = $_SERVER['HTTP_REFERER'];
$ser = $_SERVER['HTTP_HOST'];
$host = parse_url($ref);
/* and now mail it */
if($ser == $host['host'])
{
if(@mail($to1, $subject1, $message1, $headers1))
{
echo("<table align=center width=80%><tr><td><font color=$FONTCOLOR>");
echo("Dear $name1,<br>");
echo("<br>");
echo("<b>Here is your Message, sent to $to1 and $Cc1:</b><br>");
echo("<br>");
echo(" $messagebody1<br><br>");
echo("<h3>Message Sent Successfully</h3>");
echo("</font></td></tr></table>");
}
else
{
echo("<br><br><br><br><br>");
echo("Sorry unable to sent the Message.<br>");
echo("<br><br><br><br><br>");
}
}else
{
?>
<Font color=Red size=5>
<?php
echo ("Access Denied");?>
</font> <?php
}
?>
=============== END FORM PROCESSOR============
Navigation:
[Reply to this message]
|