我在php中有以下脚本,当我点击提交但没有收到电子邮件时,我收到了成功消息。我不是在做错的地方。有人可以指出正确的方向吗?
由于
//$address = "HERE your email address";
$address = "to_address@gmail.com";
// Below the subject of the email
$e_subject = 'You\'ve been contacted by ' . $name_contact . '.';
// You can change this if you feel that you need to.
$e_body = "You have been contacted by $name_contact $lastname_contact with additional message is as follows." . PHP_EOL . PHP_EOL;
$e_content = "\"$message_contact\"" . PHP_EOL . PHP_EOL;
$e_reply = "You can contact $last_name_contact via email, $email_contact.";
$msg = wordwrap( $e_body . $e_content . $e_reply, 70 );
$headers = "From: $email_contact" . PHP_EOL;
$headers .= "Reply-To: $email_contact" . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
$user = "$email_contact";
$usersubject = "Thank You";
$userheaders = "From: xxxxx@gmail.com\n";
$usermessage = "Thank you for contact COMPANY NAME. We will reply shortly!";
mail($user,$usersubject,$usermessage,$userheaders);
if(mail($address, $e_subject, $msg, $headers)) {
// Success message
echo "<div id='success_page' style='padding:20px'>";
echo "<strong >Email Sent.</strong>";
echo "Thank you <strong>$name_contact</strong>,<br> your message has been submitted. We will contact you shortly.";
echo "</div>";
} else {
echo 'ERROR!';
}