Php 如果电子邮件不是有效的电子邮件,如何删除用户

Php 如果电子邮件不是有效的电子邮件,如何删除用户,php,email,smtp,Php,Email,Smtp,我已经包括了以下代码,以删除用户,如果电子邮件没有发送,但由于某种原因,即使当我提供了一个无效的电子邮件,如sdfsd@hotmail.com,它仍在发送,有没有办法防止这种情况发生 $mail->addAttachment('images/phpmailer_mini.png'); if ($mail->send()) { echo "<meta http-equiv='refresh' content='0;url=../student_registration.

我已经包括了以下代码,以删除用户,如果电子邮件没有发送,但由于某种原因,即使当我提供了一个无效的电子邮件,如sdfsd@hotmail.com,它仍在发送,有没有办法防止这种情况发生

$mail->addAttachment('images/phpmailer_mini.png');
if ($mail->send()) {

    echo "<meta http-equiv='refresh' content='0;url=../student_registration.php?id=".htmlspecialchars($userid)."&email=".htmlspecialchars($email)."&username=".htmlspecialchars($uid)."'>";

  //  header("Location: ../student_registration.php?id=".htmlspecialchars($userid)."&email=".htmlspecialchars($email)."&username=".htmlspecialchars($uid)."");


} else {
    echo "Mailer Error: " . $mail->ErrorInfo;
     $sql13 = "DELETE FROM users WHERE user_uid = ? AND user_email = ?;";

                                 $stmt = mysqli_stmt_init($conn);
            if(!mysqli_stmt_prepare($stmt, $sql13)) {
                           echo "SQL error";
            } else {
                          mysqli_stmt_bind_param($stmt, "ss", $username, $email);
                          mysqli_stmt_execute($stmt);

大多数电子邮件/smtp服务器使用发送前接受策略。您的邮件将被服务器接受,然后再尝试向传递链中的下一个服务器进行即时传递


大多数服务器上的AFAIK在向您发送邮件的提交过程中可能会出现关于无效收件人的域丢失MX、A和AAAA记录的错误,收件人的电子邮件地址格式无效,但没有关于最终服务器上未退出的电子邮件帐户的报告。

我找不到任何关于此问题的答案,并尝试了以下代码,但未运行以下代码:$email,MS{echo valid domain;}else{echo invalid domain}我想我应该使用某种preg match and introde函数?你说它仍然将电子邮件发送到无效地址是什么意思?我用EmailAddress替换了$email变量,但仍然不起作用。。。我想只有让用户激活他或她的帐户才能验证他们的电子邮件地址