我将Google的Captcha用于我的html表单并进入php处理程序。当我填写表格(并正确),我得到消息邮件发送,但我认为PHP没有发送电子邮件。我没有收到任何邮件......这个表单和php没有重新编写,但现在我认为我的代码中存在错误。任何人都可以帮助我吗?提前谢谢!
<?php
// grab recaptcha library
require_once "recaptchalib.php";
// your secret key
$secret = "---";
// empty response
$response = null;
// check secret key
$reCaptcha = new ReCaptcha($secret);
// if submitted check response
if ($_POST["g-recaptcha-response"]) {
$response = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
if(isset($_POST['submit'])) {
$to = "---@hotmail.com";
$subject = "Contact ---.synology.me";
$name_field = $_POST['username'];
$sex = $_POST['sex'];
$email_field = $_POST['email'];
$password1 = $_POST['pwd1'];
$password2 = $_POST['pwd2'];
$comment = $_POST['comment'];
$body = " NL\n Afzender: $name_field\n Geslacht: $sex\n Emailadres:
$email_field\n Wachtwoord 1: $password1\n Wachtwoord 2: $password2\n
Suggestie: $comment\n";
echo "<script>
if(confirm('MAIL SEND!')){
window.location.href = 'https://---.synology.me/account-aanvragen.html';
}else{
window.location.href = 'https://---.synology.me/account-aanvragen.html';
}
</script>";
$headers = "From: ---@hotmail.com" . "\r\n";
mail($to, $subject, $body, $headers);
} else {
echo "Er ging iets mis, probeer opnieuw of contacteer de administrator op ---@hotmail.com!";
}
} else {
echo "<script>
if(confirm('Bevestig dat je geen robot bent!')){
window.location.href = 'https://---.synology.me/account-aanvragen.html';
}else{
window.location.href = 'https://---.synology.me/account-aanvragen.html';
}
</script>";
}
?>