无法将邮件发送到所有电子邮件

时间:2019-05-02 16:59:25

标签: php email

我的问题是我似乎无法将邮件发送到所有电子邮件地址。例如,我可以发送到我的主要Google地址wilmer.blomkvist@gmail.com,但不能将其发送到example muhamet.g@hotmail.com。我无法将其发送到其他gmail帐户,也无法发送至我自己的wilmer.blomkvist@zakthor.nu邮件。似乎我只能将邮件发送到我的主要Gmail帐户。有人知道为什么会这样吗?

<?php
    session_start();

    if(isset($_POST['uSignupSubmit'])) {

        include '../conn.php';

        $userRegister = mysqli_real_escape_string($conn, $_POST['uSignupUsername']);
        $to = mysqli_real_escape_string($conn, $_POST['uSignupMail']);
        $passRegister = mysqli_real_escape_string($conn, $_POST['uSignupPassword']);
        $phoneRegister = mysqli_real_escape_string($conn, $_POST['uSignupPhone']);
        $numberRegister = mysqli_real_escape_string($conn, $_POST['uSignupNumber']);
        $ipRegister = mysqli_real_escape_string($conn, $_SERVER['REMOTE_ADDR']);

        $eSQL = "SELECT * FROM personinfo WHERE Email='$to'";
        $eResult = mysqli_query($conn, $eSQL);
        $uSQL = "SELECT * FROM personinfo WHERE Name='$userRegister'";
        $uResult = mysqli_query($conn, $uSQL);
        $pSQL = "SELECT * FROM personinfo WHERE Phone='$phoneRegister'";
        $pResult = mysqli_query($conn, $pSQL);
        $nSQL = "SELECT * FROM personinfo WHERE Pnumber='$numberRegister'";
        $nResult = mysqli_query($conn, $nSQL);

        if(empty($userRegister) || empty($to) || empty($passRegister) || empty($phoneRegister) || empty($numberRegister)) {
            header("refresh:0; url=/page.php?id=signup&error=Empty%20fields");
            exit;
        } 
        else if(mysqli_fetch_assoc($eResult) > 0) {
            header("refresh:0; url=/page.php?id=signup&error=Mail%20exists");
            exit;
        } 
        else if(mysqli_fetch_assoc($uResult) > 0) {
            header("refresh:0; url=/page.php?id=signup&error=User%20exists");
            exit;
        }  
        else if(mysqli_fetch_assoc($pResult) > 0) {
            header("refresh:0; url=/page.php?id=signup&error=Phone%20number%20exists");
            exit;
        }  
        else if(mysqli_fetch_assoc($nResult) > 0) {
            header("refresh:0; url=/page.php?id=signup&error=Person%20number%20exists");
            exit;
        } else {
            $vkey = mt_rand(1000, 100000); 
            $insertSQL = "INSERT INTO personinfo (Name, Password, Email, Phone, Pnumber, IP, vkey) VALUES ('$userRegister', '$passRegister', '$to', '$phoneRegister', '$numberRegister', '$ipRegister', '$vkey')";

            if(!mysqli_query($conn, $insertSQL)) {
                echo 'Failed to insert';
                exit;
            } else {
                session_start();
                $_SESSION['user'] = $userRegister;
                $_SESSION['verify'] = 'false';

                $mailSubject = 'SteelGaming Verification';
                $mailMessage = '<h2>Hello ' . $userRegister . '!</h2><br><br>Please verificate your account at SteelGaming.se to fully register!<br>Verification link: www.steelgaming.se/ver?vkey=' . $vkey;
                $headers = "From: SteelGaming <mail@steelgaming.se>\r\n";
                $headers .= "Reply-To: SteelGaming <mail@steelgaming.se>\r\n";
                $headers .= "Content-type: text/html\r\n";

                mail($to, $mailSubject, $mailMessage, $headers);
                header("refresh:0; url=/page.php?id=home");
            }
        }
    }
?>

0 个答案:

没有答案