You are here: help needed with mail script « All PHP « IT news, forums, messages
help needed with mail script

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация