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

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

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

        无法连接到 SMTP 服务器

        时间:2024-08-23
          <tbody id='zycjR'></tbody>
          • <tfoot id='zycjR'></tfoot>

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

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

                • <i id='zycjR'><tr id='zycjR'><dt id='zycjR'><q id='zycjR'><span id='zycjR'><b id='zycjR'><form id='zycjR'><ins id='zycjR'></ins><ul id='zycjR'></ul><sub id='zycjR'></sub></form><legend id='zycjR'></legend><bdo id='zycjR'><pre id='zycjR'><center id='zycjR'></center></pre></bdo></b><th id='zycjR'></th></span></q></dt></tr></i><div id='zycjR'><tfoot id='zycjR'></tfoot><dl id='zycjR'><fieldset id='zycjR'></fieldset></dl></div>
                • 本文介绍了无法连接到 SMTP 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个支持邮件的服务器,比如 example.com.我配置了服务器并通过 cpanel 添加了 MX 记录,以便我可以通过 outlook.com 接收和发送地址为 myaddr@example.com 的邮件.MX 记录来自 domains.live.com.

                  I have a server with mail support, say example.com. I configured the server and added MX records via cpanel, so that I can receive and send mails via outlook.com with address myaddr@example.com. The MX records are got from domains.live.com.

                  现在我需要使用 PHP 使用 SMTP 以编程方式发送邮件.我使用以下脚本尝试了 PHPmailer.但它显示错误

                  Now I need to send mail programmatically using PHP using SMTP. I tried PHPmailer using the following script. But it is showing the error

                  Mailer Error: SMTP Connect() failed. 
                  

                  (但我可以使用 myaddr@example.com 通过 outlook.com 发送和接收电子邮件)

                  (But I can send and receive emails via outlook.com using myaddr@example.com)

                  $body             = $_POST['message'];
                  
                  $to = "support@example.org";
                  $from = 'fromAddress@gmail.com';
                  $fName = 'first name';
                  $lName = 'last name';
                  $subject =  'my subject';
                  $mail = new PHPMailer();
                  $mail->IsSMTP();
                  $mail->CharSet = 'UTF-8';
                    //  $body             = eregi_replace("[]",'',$body);
                  $mail->Host       = "mail.example.org"; // SMTP server example
                  $mail->SMTPDebug  = 0;           // enables SMTP debug information (for testing)
                  $mail->SMTPAuth   = true;        // enable SMTP authentication
                  $mail->Port       = 25;          // set the SMTP port for the GMAIL server
                  $mail->Username   = "myaddr@example.org"; // SMTP account username example
                  $mail->Password   = "password";
                  $mail->SetFrom($from, $fName.' '.$lName);
                  $mail->Subject = $subject;
                  $mail->AddAddress($to, "Support Team");
                  $mail->MsgHTML($body);
                  
                  if(!$mail->Send()) {
                       echo "Mailer Error: " . $mail->ErrorInfo;
                  exit;
                  }
                  

                  我该如何解决这个问题.

                  How can I resolve the issue.

                  推荐答案

                  最后我只是通过替换下面的一些设置解决了这个问题,它工作了:).

                  Finally I just solved the issue by replacing some of the settings as below and it worked :).

                      $mail->Host       = "smtp-mail.outlook.com"; // SMTP server example
                      $mail->Port       = 587;  
                      $mail->SMTPSecure = 'tls';
                  

                  这篇关于无法连接到 SMTP 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用 XAMPP 使用 Google SMTP 服务器发送电子邮件? 下一篇:当我通过其他 SMTP 服务器发送电子邮件时,电子邮件进入垃圾邮件

                  相关文章

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

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

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

                    1. <small id='kmT0I'></small><noframes id='kmT0I'>