SMTP 在主机上运行良好但在 bamboozle.me 主机上运行不正常?

SMTP Working good on hostinger and not working on bamboozle.me host?

请大家帮我解决以下错误?我使用的是 smtp php 邮件程序,它在托管程序上运行良好,没有错误,我确实收到了电子邮件,但它在我的 bamboozle 托管网站上不起作用。请帮助我。

2022-05-21 16:29:18 SERVER -> CLIENT: 220-cp-dxb-001.bamboozle.me ESMTP Exim 4.95 #2 Sat, 21 
May 2022 20:29:18 +0400 220-We do not authorize the use of this system to transport 
unsolicited, 220 and/or bulk e-mail.
2022-05-21 16:29:18 CLIENT -> SERVER: EHLO www.eighty6.shop
2022-05-21 16:29:18 SERVER -> CLIENT: 250-cp-dxb-001.bamboozle.me Hello www.eighty6.shop 
[185.93.244.110]250-SIZE 52428800250-8BITMIME250-PIPELINING250-PIPE_CONNECT250-AUTH PLAIN 
LOGIN250 HELP
2022-05-21 16:29:18 CLIENT -> SERVER: AUTH LOGIN
2022-05-21 16:29:18 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2022-05-21 16:29:18 CLIENT -> SERVER: [credentials hidden]
2022-05-21 16:29:18 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2022-05-21 16:29:18 CLIENT -> SERVER: [credentials hidden]
2022-05-21 16:29:21 SERVER -> CLIENT: 535 Incorrect authentication data
2022-05-21 16:29:21 SMTP ERROR: Password command failed: 535 Incorrect authentication data
SMTP Error: Could not authenticate.
2022-05-21 16:29:21 CLIENT -> SERVER: QUIT
2022-05-21 16:29:21 SERVER -> CLIENT: 221 cp-dxb-001.bamboozle.me closing connection
2022-05-21 16:29:21 SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Something is wrong:
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

这是我的代码

<?php

// Subscribe my channel if you are using this code
// Subscribe my channel if you are using this code
// Subscribe my channel if you are using this code
// Subscribe my channel if you are using this code
// Subscribe my channel if you are using this code


use PHPMailer\PHPMailer\PHPMailer;
function sendmail(){
    $name = "EX - Joey";  // Name of your website or yours
    $to = "mail@gmail.com";  // mail of reciever
    $subject = "Tutorial or any subject";
    $body = "Send Mail Using PHPMailer - MS The Tech Guy";
    $from = "mail@gmail.com";  // you mail
    $password = "pass";  // your mail password

    // Ignore from here

    require_once "PHPMailer/PHPMailer.php";
    require_once "PHPMailer/SMTP.php";
    require_once "PHPMailer/Exception.php";
    $mail = new PHPMailer();

    // To Here

    //SMTP Settings
    $mail->isSMTP();
    $mail->SMTPDebug = 2;                           
    $mail->Host = "smtp.gmail.com"; // smtp address of your email
    $mail->SMTPAuth = true;
    $mail->Username = $from;
    $mail->Password = $password;
    $mail->Port = 465;  // port
    $mail->SMTPSecure = "ssl";  // tls or ssl
    $mail->smtpConnect([
    'ssl' => [
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
        ]
    ]);

    //Email Settings
    $mail->isHTML(true);
    $mail->setFrom($from, $name);
    $mail->addAddress($to); // enter email address whom you want to send
    $mail->Subject = ("$subject");
    $mail->Body = $body;
    if ($mail->send()) {
        echo "Email is sent!";
    } else {
        echo "Something is wrong: <br><br>" . $mail->ErrorInfo;
    }
}


    // sendmail();  // call this function when you want to

    if (isset($_GET['sendmail'])) {
        sendmail();
    }
?>


 <html>
   <head>
      <title>Send Mail</title>
   </head>
  <body>
    <form method="get">
        <button type="submit" name="sendmail">sendmail</button>
    </form>
  </body>
</html>

我还尝试更改端口值但没有发生任何事情,因为具有相同凭据和 smtp 设置的相同代码在托管商上运行。

请注意您如何在脚本中请求连接到 smtp.gmail.com,但它实际上是连接到 cp-dxb-001.bamboozle.me

那是因为您的托管服务提供商将您的 SMTP 流量重定向到他们的邮件服务器,as described in the troubleshooting guide

不幸的是,您禁用了 TLS 证书验证,因此它仍然可以连接,结果您泄露了您的 gmail 帐户的凭据,现在您需要更改密码。这里的教训是阅读错误信息,不要禁用证书验证。

您需要使用他们的邮件服务器,说服他们停止重定向您的 SMTP 流量,或者寻找更好的托管服务提供商。