<i id='mrwWT'><tr id='mrwWT'><dt id='mrwWT'><q id='mrwWT'><span id='mrwWT'><b id='mrwWT'><form id='mrwWT'><ins id='mrwWT'></ins><ul id='mrwWT'></ul><sub id='mrwWT'></sub></form><legend id='mrwWT'></legend><bdo id='mrwWT'><pre id='mrwWT'><center id='mrwWT'></center></pre></bdo></b><th id='mrwWT'></th></span></q></dt></tr></i><div id='mrwWT'><tfoot id='mrwWT'></tfoot><dl id='mrwWT'><fieldset id='mrwWT'></fieldset></dl></div>

    1. <legend id='mrwWT'><style id='mrwWT'><dir id='mrwWT'><q id='mrwWT'></q></dir></style></legend>

      <small id='mrwWT'></small><noframes id='mrwWT'>

        • <bdo id='mrwWT'></bdo><ul id='mrwWT'></ul>
      1. <tfoot id='mrwWT'></tfoot>

        使用 Gmail SMTP 发送电子邮件时出错

        Error sending e-mail using Gmail SMTP(使用 Gmail SMTP 发送电子邮件时出错)
        1. <small id='ul5lC'></small><noframes id='ul5lC'>

          <tfoot id='ul5lC'></tfoot>
              <tbody id='ul5lC'></tbody>
            • <bdo id='ul5lC'></bdo><ul id='ul5lC'></ul>

                • <legend id='ul5lC'><style id='ul5lC'><dir id='ul5lC'><q id='ul5lC'></q></dir></style></legend>
                  <i id='ul5lC'><tr id='ul5lC'><dt id='ul5lC'><q id='ul5lC'><span id='ul5lC'><b id='ul5lC'><form id='ul5lC'><ins id='ul5lC'></ins><ul id='ul5lC'></ul><sub id='ul5lC'></sub></form><legend id='ul5lC'></legend><bdo id='ul5lC'><pre id='ul5lC'><center id='ul5lC'></center></pre></bdo></b><th id='ul5lC'></th></span></q></dt></tr></i><div id='ul5lC'><tfoot id='ul5lC'></tfoot><dl id='ul5lC'><fieldset id='ul5lC'></fieldset></dl></div>
                  本文介绍了使用 Gmail SMTP 发送电子邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 Gmail SMTP 和 PHPmailer 发送电子邮件.

                  I'm trying to send e-mail using Gmail SMTP and PHPmailer.

                  问题是我有这个错误:

                  SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo   failed: No such host is known. (0) 
                  
                  SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.
                  

                  这是我正在使用的代码:

                  Here's the code I am using:

                  ?php
                  
                      require_once($_SERVER['DOCUMENT_ROOT'].'/FreeUni/Kiosk/class.phpmailer.php');
                  
                      $mail  = new PHPMailer();   
                      $mail->IsSMTP();
                  
                      //GMAIL config
                      $mail->SMTPAuth   = true;                  // enable SMTP authentication
                      $mail->SMTPSecure = "ssl";                 // sets the prefix to the server
                      $mail->Host       = "ssl://smtp.gmail.com:465";      // sets GMAIL as the SMTP server
                  
                      $mail->Username   = "XXXX@gmail.com";  // GMAIL username
                      $mail->Password   = "XXXXXX";            // GMAIL password
                      $mail->SMTPDebug = 1;
                      //End Gmail
                  
                      $mail->From       = "gvakh10@gmail.com";
                      $mail->FromName   = "you name";
                      $mail->Subject    = "some subject";
                      $mail->MsgHTML("the message");
                  
                      //$mail->AddReplyTo("reply@email.com","reply name");//they answer here, optional
                      $mail->AddAddress("XXXX@gmail.com","name to");
                      $mail->IsHTML(true); // send as HTML
                  
                      if(!$mail->Send()) {//to see if we return a message or a value bolean
                          echo "Mailer Error: " . $mail->ErrorInfo;
                      } else  echo "Message sent!";
                  
                  ?>
                  

                  我已经在网上搜索过,但找不到解决方案

                  I've already searched the web but couldn't find the solution

                  推荐答案

                  我换了

                  $mail->Host = "ssl://smtp.gmail.com:465";

                  只有

                  $mail->Host="smtp.gmail.com:465";

                  成功了!!!

                  谢谢大家.

                  这篇关于使用 Gmail SMTP 发送电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  smtp gmail server php mailer not working(smtp gmail服务器php邮件程序不工作)
                  Email goes in spam when I send it via others SMTP server(当我通过其他 SMTP 服务器发送电子邮件时,电子邮件进入垃圾邮件)
                        <tfoot id='qeUQp'></tfoot>
                        <i id='qeUQp'><tr id='qeUQp'><dt id='qeUQp'><q id='qeUQp'><span id='qeUQp'><b id='qeUQp'><form id='qeUQp'><ins id='qeUQp'></ins><ul id='qeUQp'></ul><sub id='qeUQp'></sub></form><legend id='qeUQp'></legend><bdo id='qeUQp'><pre id='qeUQp'><center id='qeUQp'></center></pre></bdo></b><th id='qeUQp'></th></span></q></dt></tr></i><div id='qeUQp'><tfoot id='qeUQp'></tfoot><dl id='qeUQp'><fieldset id='qeUQp'></fieldset></dl></div>
                          <tbody id='qeUQp'></tbody>

                        <small id='qeUQp'></small><noframes id='qeUQp'>

                        • <legend id='qeUQp'><style id='qeUQp'><dir id='qeUQp'><q id='qeUQp'></q></dir></style></legend>
                          • <bdo id='qeUQp'></bdo><ul id='qeUQp'></ul>