Похоже, что к send.php обращаются и отправляют пустые электронные письма. Необходимо сделать так, чтобы send.php не отправлял электронную почту, если только кнопка отправки не используется в форме. Мне сказали, что 'isset $ _post' поможет мне, но не совсем понятно, как его выполнить.
Вот код send.php:
<?php
$recipient = 'test@test.com';
$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: test@test.com\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";
}
}
?>