Kullanıcı hesap açtıktan sonra bir onay e-postası göndermeye çalışıyorum. E-posta hiçbir şey göndermiyor. Bunu test ettim ve e-posta spam veya gelen kutusu klasörüne bile gitmiyor. Bir şey mi eksik? Yardımın için teşekkürler.PHP ile bir e-posta gönderilemiyor
$status = "";
if (isset($_POST["sign_up"])) {
$first_name = (isset($_POST['first_name']) ? $_POST['first_name'] : null);
$last_name = (isset($_POST['last_name']) ? $_POST['last_name'] : null);
$username = (isset($_POST['username']) ? $_POST['username'] : null);
$password = (isset($_POST['password']) ? $_POST['password'] : null);
$email = (isset($_POST['email']) ? $_POST['email'] : null);
$phone = (isset($_POST['phone']) ? $_POST['phone'] : null);
if ($first_name == "" || $last_name == "" || $username == "" || $password == "" || $email == "" || $phone == "") {
$status = '<p style="color:#FF0000;">Please fill out all the field';
} else if (strlen($password) < 6) {
$status = '<p style="color:#FF0000;">Password must more than 6 characters';
} else{
$sql = "INSERT INTO members(
first_name,
last_name,
username,
password,
email,
phone
) VALUES (
'$first_name',
'$last_name',
'$username',
'$password',
'$email',
'$phone'
)";
$res = mysqli_query($mysqli,$sql) or die(mysqli_error());
if ($res) {
$to = $email;
$subject = "Confirmation from Yu Fong to $username";
$from = "[email protected]";
$message = "Please click the link below to verify and activate your account. \r\n";
$message .= "Testing";
$header = "From: " .$from. "\r\n";
$header .="Reply-To: ".$from. "\r\n";
$header .= "CC: [email protected]\r\n";
$header .= "Return-Path: ".$from. "\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$header .= "X-Priority: 3\r\n";
$header .= "X-Mailer: PHP". phpversion() ."\r\n";
$sentmail = mail($to, $subject, $message, $header);
if ($sentmail == true) {
echo $status = '<p style="color:#FF0000;">Congratulations! Your account has been created. An confirmation email has been sent!';
} else {
echo "Eror!";
}
}
}
}
Olası yinelenen deneyin (http://stackoverflow.com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail) – Chris
Bazı posta sağlayıcıları spam'leri caydırmak için Gönderen IP adresi ters DNS araması yapmazsa postayı reddet. Sebep bu olabilir mi? Yerel posta kutunuzu veya SMTP yazılımınızın kayıtlarını kontrol edin. –
@TylerCrompton Bence DNS nedeni olabilir. E-postayı aldım ama spam klasöründe bunun olmasını nasıl engelleyebilirim? Teşekkür ederim. –