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

  • <small id='7v2T2'></small><noframes id='7v2T2'>

    <tfoot id='7v2T2'></tfoot>
      • <bdo id='7v2T2'></bdo><ul id='7v2T2'></ul>

      1. 将 PHPMailer 用于 SMTP 的问题

        时间:2024-08-23

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

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

                  <bdo id='ULv8p'></bdo><ul id='ULv8p'></ul>

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

                  本文介绍了将 PHPMailer 用于 SMTP 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I have used PHPMailer for SMTP and there is problem in sending mail with error "Mailer Error: The following From address failed: no-reply@mydomain.org.uk"

                  My code is as follows:

                          $mail = new PHPMailer();
                  
                          $mail->IsSMTP();                                   // send via SMTP
                  
                          $mail->Host = "localhost;"; // SMTP servers
                  
                          $mail->SMTPAuth = true;     // turn on SMTP authentication
                  
                          $mail->Username = "";  // SMTP username
                  
                          $mail->Password = ""; // SMTP password
                  
                  
                  
                          $mail->From = $email_address;
                  
                          $mail->FromName = $email_address;
                  
                          $mail->AddAddress($arrStudent[0]["email"]);
                  
                          $mail->WordWrap = 50;                              // set word wrap
                  
                          $mail->IsHTML(true);                               // send as HTML
                  
                  
                  
                          $mail->Subject = "Subject";
                  
                          $theData = str_replace("
                  ", "<BR>", $stuff);
                  
                          $mail->Body = $theData; // "This is the <b>HTML body</b>";
                  
                          $mail->AltBody = $stuff;
                  
                  
                  
                  
                          if (!$mail->Send()) {
                  
                              $sent = 0;
                  
                              echo "Mailer Error: " . $mail->ErrorInfo;
                  
                              exit;
                  
                          }
                  

                  i researched everything and when i debug inside class.smtp.php i found error the function "get_lines()" is returning error value "550 Authentication failed"

                  The code was working fine previously, i am wondering how this problem came suddenly. Desperate for some help.

                  Thanks, Biplab

                  解决方案

                  public function sendEmail ( $subject, $to, $body, $from = FALSE ) {
                      require_once('mailer.class.php');
                      $mailer = new PHPMailer();
                      //do we use SMTP?
                      if ( USE_SMTP ) {
                          $mailer->IsSMTP();
                          $mailer->SMTPAuth = true;
                          $mailer->Host = SMTP_HOST;
                          $mailer->Port = SMTP_PORT;
                          $mailer->Password = '';
                          $mailer->Username = '';
                          if(USE_SSL)
                              $mailer->SMTPSecure = "ssl";
                      }
                  
                      $mailer->SetFrom($from?$from:ADMIN_EMAIL, ADMIN_NAME);
                      $mailer->AddReplyTo ( ADMIN_EMAIL, ADMIN_NAME );
                  
                      $mailer->AddAddress($to);
                      $mailer->Subject = $subject;
                      //$mailer->WordWrap = 100;
                      $mailer->IsHTML ( TRUE );
                      $mailer->MsgHTML($body);
                  
                      require_once('util.class.php');
                      $mailer->AltBody  =  Util::html2text ( $body );
                  
                      //$mail->AddAttachment("images/phpmailer.gif");      // attachment
                      //$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
                  
                      if ( ! $mailer->Send() ) {
                          return FALSE;
                      }
                      else {
                          $mailer->ClearAllRecipients ();
                          $mailer->ClearReplyTos ();
                          return TRUE;
                      }
                  }
                  

                  I've used like that... SetFrom should be used in place of From... that's your error buddy... :))

                  这篇关于将 PHPMailer 用于 SMTP 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题 下一篇:Laravel Gmail 配置错误

                  相关文章

                    • <bdo id='HQked'></bdo><ul id='HQked'></ul>
                    <tfoot id='HQked'></tfoot>

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

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

                      <legend id='HQked'><style id='HQked'><dir id='HQked'><q id='HQked'></q></dir></style></legend>