0
我不知道为什么,但我没有设法在提交html表单后收到任何电子邮件。 我可以看到数据库中的数据,但我没有收到任何电子邮件。 发送后,我把一些代码工作得很好。只有邮件没有发送。将数据添加到数据库并在提交表单后发送电子邮件
请帮帮我。
的PHP文件:
<?php
$Name = $_POST['Name'];
$Phone= $_POST['Phone'];
$Email= $_POST['Email'];
$Subject= $_POST['Subject'];
$Message= $_POST['message'];
$conn = mysql_connect("MyServerName", "userName", "password");
mysql_select_db("Mydbname",$conn);
$sql = "INSERT INTO FC(Name, Phone, Email, Subject, Message)
VALUES ('$Name', '$Phone', '$Email', '$Subject', '$Message')";
if (mysql_query($sql, $conn)) {
$to = "[email protected]"; // this is your Email address
$from = "[email protected]"; // this is the sender's Email address
$headers = "From: " . $Email;
$subject = "Form submission - " . $Subject;
$message = $Name . " wrote the following:" . "\n\n" . $Message . "\n\n" . "His Phone number is: " . $Phone;
mail($to,$subject,$message,$headers);
echo '<html>
<head>
<meta http-equiv="refresh" content="0.1;url=http://www.google.com" />
</head>
<body>';
echo '<script language="javascript">';
echo 'alert("message successfully sent! we will contact you shortly.")';
echo '</script>';
echo '</body></html>';
} else {
echo "something went wrong";
}
?>
您是否收到任何错误?如果您没有收到错误,请检查您是否收到垃圾邮件。 – TheZozoOwner
你是否检查过你的php.ini文件,如果它更新了SMTP服务器的详细信息。 – Chandresh
我无法相信我所有的100000封测试邮件都寄给了我的垃圾邮件!非常感谢并为这种愚蠢感到抱歉! –