【问题标题】:PHP SMTP ERROR: SMTP server response: 530 5.7.0PHP SMTP 错误:SMTP 服务器响应:530 5.7.0
【发布时间】:2020-06-14 08:31:35
【问题描述】:

我收到一个错误

警告:mail():SMTP 服务器响应:530 5.7.0 必须先发出 STARTTLS 命令。 z10sm5799896oih.1 - 第 47 行 C:\wamp64\www\Change.php 中的 gsmtp

我用谷歌搜索了它,但找不到任何有帮助的东西。我不确定下一步该怎么做 请帮忙

这是代码

<?php
// Connect to MySQL
$username = "*****"; 
$password = "*****"; 
$host = "*********"; 
$dbname = "*****"; 
try {
$conn = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password);
}
catch(PDOException $ex) 
{ 
    $msg = "Failed to connect to the database"; 
} 

// Was the form submitted?
if (isset($_POST["ForgotPassword"])) {

// Harvest submitted e-mail address
if (filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
    $email = $_POST["email"];

}else{
    echo "email is not valid";
    exit;
}

// Check to see if a user exists with this e-mail
$query = $conn->prepare('SELECT email FROM user WHERE email = :email');
$query->bindParam(':email', $email);
$query->execute();
$userExists = $query->fetch(PDO::FETCH_ASSOC);
$conn = null;

if ($userExists["email"])
{
    // Create a unique salt. This will never leave PHP unencrypted.
    $salt = "498#2D83B631%3800EBD!801600D*7E3CC13";

    // Create the unique user password reset key
    $password = hash('sha512', $salt.$userExists["email"]);

    // Create a url which we will direct them to reset their password
    $pwrurl = "www.yoursitehere.com/reset_password.php?q=".$password;

    // Mail them their key
    $mailbody = "Dear user,\n\nIf this e-mail does not apply to you please ignore it. It appears that 
 you have requested a password reset at our website www.*****.com\n\nTo reset your password, please 
click the link below. If you cannot click it, please paste it into your web browser's address 
bar.\n\n" . $pwrurl . "\n\nThanks,\nThe Administration";



 **This is where the error is**
    mail($userExists["email"], "www.*****.com - Password Reset", $mailbody);





    echo "Your password recovery key has been sent to your e-mail address.";

}
else
    echo "No user with that e-mail address exists.";
}
?>

【问题讨论】:

标签: php


【解决方案1】:

1.尝试远程登录 使用 telnet 命令可以实际测试端口是否打开。

试试这个:

//Type the following command to see if Port 25 is blocked on your network. 
telnet pepipost.com 25

如果端口 25 未被阻塞,您将获得成功的 220 响应(文本可能会有所不同)。

Trying 202.162.247.93... 
Connected to pepipost.com. 
Escape character is '^]'. 
220 pepipost.com ESMTP Postfix

如果端口 25 被阻塞,您将收到连接错误或根本没有响应。

Trying 202.162.247.93...
telnet: connect to address 202.162.247.93: Connection refused
telnet: Unable to connect to remote host

2。使用 outPorts
outPorts 是 GitHub 上一个非常好的开源软件,它会扫描你所有的端口并给出结果。 安装 outPorts 后,您可以在终端中键入以下命令来检查端口 25 的连接性: 输出端口 25

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-13
    • 1970-01-01
    • 2014-06-27
    • 2016-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-07
    相关资源
    最近更新 更多