【问题标题】:Getting error about SMTP with PHPMailer使用 PHPMailer 获取有关 SMTP 的错误
【发布时间】:2017-02-25 14:23:22
【问题描述】:

我正在尝试重置我的密码,但它不起作用

错误:

SMTP 错误:无法验证。错误:SMTP 错误:无法 验证。

我正在使用以下代码发送电子邮件:

<?php
  require_once ("PHPMailer_v5.1\class.phpmailer.php");
  $Correo = new PHPMailer();
  $Correo->IsSMTP();
  $Correo->SMTPAuth = true;
  $Correo->SMTPSecure = "tls";
  $Correo->Host = "smtp.gmail.com";
  $Correo->Port = 587;
  $Correo->Username = "foo@gmail.com";
  $Correo->Password = "123456";
  $Correo->SetFrom('foo@gmail.com','De Yo');
  $Correo->FromName = "From";
  $Correo->AddAddress("foo@gmail.com");
  $Correo->Subject = "testing PHPMailer";
  $Correo->Body = "<H3>it works!</H3>";
  $Correo->IsHTML (true);
  if (!$Correo->Send())
  {
    echo "Error: $Correo->ErrorInfo";
  }
  else
  {
    echo "Message Sent!";
  }
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Frank Parts C.A. - Módulo de Recuperación de Contraseña</title>

<!-- bootstrap -->
    <link rel="stylesheet" href="assests/bootstrap/css/bootstrap.min.css">
    <!-- bootstrap theme-->
    <link rel="stylesheet" href="assests/bootstrap/css/bootstrap-theme.min.css">
    <!-- font awesome -->
    <link rel="stylesheet" href="assests/font-awesome/css/font-awesome.min.css">

  <!-- custom css -->
  <link rel="stylesheet" href="custom/css/custom.css">  

  <!-- jquery -->
    <script src="assests/jquery/jquery.min.js"></script>
  <!-- jquery ui -->  
  <link rel="stylesheet" href="assests/jquery-ui/jquery-ui.min.css">
  <script src="assests/jquery-ui/jquery-ui.min.js"></script>

  <!-- bootstrap js -->
    <script src="assests/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
      <form class="form-signin" method="POST">

      <?php if(isset($smsg)){ ?><div class="alert alert-success" role="alert"> <?php echo $smsg; ?> </div><?php } ?>
      <?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php } ?>
        <h2 class="form-signin-heading">¿Olvidó su Contraseña?</h2>
        <br> <br>
        <div class="input-group">
      <span class="input-group-addon" id="basic-addon1">@</span>
      <input type="text" name="username" class="form-control" placeholder="Nombre de Usuario" required>
    </div>
    <br><br><br>
        <button class="btn btn-lg btn-primary btn-block" type="submit">Recuperar Contraseña</button>
        <a class="btn btn-lg btn-primary btn-block" href="index.php">Iniciar Sesión</a>
      </form>
</div>

</body>
</html>

我正在使用 PHP Mailer,尝试了不同的代码但没有任何效果..

谁能帮帮我?

【问题讨论】:

  • 尝试不同的端口;

标签: php html smtp phpmailer


【解决方案1】:

这是因为密码包含特殊字符。我尝试在 Password="djgh\^dfgfjk" 等特殊字符之前使用“\”。但这对我没有帮助。 我只是创建没有任何特殊字符的新 ID 和简单密码,而且令人惊讶的是它的工作。 使用不带特殊字符的密码。

【讨论】:

  • 它有一个简单的密码,但它不起作用。我尝试使用新用户和简单密码.. 同样的错误
猜你喜欢
  • 2012-11-16
  • 2015-12-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多