看起來像正在訪問send.php併發送空白電子郵件。需要這樣做,因此send.php不會發送電子郵件,除非在表單上使用提交按鈕。我被告知'isset $ _post'會幫助我,只是不清楚如何執行它。PHP聯繫表空白電子郵件
這裏的send.php代碼:
<?php
$recipient = '[email protected]';
$email = $_REQUEST['Email'];
$subject = 'Contact Form Submission';
$content = "The following has been submitted on your website \n\n";
$redirect = 'thankyoupage.html';
$user = $_REQUEST['Email'];
$usersubject = "Subject";
$userheaders = "From: [email protected]\n";
$usermessage = "Blah blah blah";
mail($to,$subject,$message,$headers);
mail($user,$usersubject,$usermessage,$userheaders);
foreach($_POST as $k=>$v)
{
$content .= "$k: $v\n\n";
}
mail_it(stripslashes($content), $subject, $email, $recipient);
if (isset($_POST['redirect']))
{
header("Location:".$_POST['redirect']);
}
else
{
header("Location: $redirect");
}
function mail_it($content, $subject, $email, $recipient)
{
$headers .= "From: ".$email."\n";
$headers .= "Reply-To: ".$email."\n";
if ($bcc) $headers .= "Bcc: ".$bcc."\n";
$headers .= "X-Priority: 0\n";
$headers .= "X-Mailer: bjm Formmail \n";
$message = $content."\n\n";
if(!mail($recipient, $subject, $message, $headers))
{
echo "Sorry - an error occured trying to send the mail";
}
}
?>
你怎麼打電話send.php? – cbarg 2012-01-15 02:14:20