PHP邮件设置

时间:2010-09-16 10:33:07

标签: php

我刚刚开始担任Flash网页设计师。现在我打造一个flash网站。

我在flash&上传网页内容我使用HTML文件。我还在这个网站上创建了一个CONTACT US页面。现在我必须发送电子邮件。因为我使用PHP编码。但是,当我点击发送按钮,然后我收到一个错误。我的错误是

".$mess[1]."   ".$mess[0]."
"; } next($post_vars); } mail($_REQUEST['recipient'], $subject, "
".$message." " , $headers); echo ("Your message was successfully sent!"); ?> // 

在本页我使用此代码..代码是

<?
Error_Reporting(E_ALL & ~E_NOTICE);

 while ($request = current($_REQUEST)) {
    if (key($_REQUEST)!='recipient') {
        $pre_array=split ("&777&",  $request);
        $post_vars[key($_REQUEST)][0]=$pre_array[0];
        $post_vars[key($_REQUEST)][1]=$pre_array[1];
    }
    next($_REQUEST);
}



reset($post_vars);


$subject="From ".$post_vars['your_name'][0] ;
$headers= "From: ".$post_vars['your_email'][0] ."\n";
 $headers.='Content-type: text/html; charset=iso-8859-1';
 $message='';
  while ($mess = current($post_vars)) {
    if ((key($post_vars)!="i") && (key($post_vars)!="\your_email") && (key($post_vars)!="your_name")) {

        $message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
    }
    next($post_vars);
 }

mail($_REQUEST['recipient'], $subject,  "
<html>
<head>
 <title>Contact letter</title>
</head>
<body>
<br>
  ".$message."
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");

?>
<script>
    resizeTo(300, 300);
</script>

............................................... ..

请帮我解决这个错误....

请回复.....

1 个答案:

答案 0 :(得分:0)

你的错误没有意义,那只是一些代码。

您的表单也容易受到电子邮件标头注入的攻击。 W3Schools有一个better code sample的联系表格。

请避免使用$_REQUEST来发送电子邮件等内容。 您可能认为必须提交表单才能发送邮件。 但是使用$_REQUEST,您也可以直接打开页面,如domail.php?your_name=somename&your_email=someone@example.com