dqqt31923 2018-03-22 21:20
浏览 68

错误8085#0:* 71722上游超时

currently I am trying to use the Phpmailer for a school project. I do not know a lot about server or nginx. When I use the code for the phpmailer nothing seems to happen, but after a while I get this error allert:

[error] 8085#0: *71722 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 2.203.50.189, server: delivery.nginx.xxxxxxxxxxxxxxxxxxxx.net, request: "POST /register.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "xxxxxxxxxxxxxxxxxxxxxxxx.net", referrer: "http://xxxxxxxxxxxxxxxxxxxxxx.net"

It would be awesome if someone knows how to fix this problem. Thanks alot!!

The code for the phpmailer:

<?php
    use PHPMailer\PHPMailer\PHPMailer;
    date_default_timezone_set('Etc/UTC');
            require 'vendor/autoload.php';
            //Create a new PHPMailer instance
            //$mailer = new PHPMailer(true);
            $mail = new PHPMailer();
            //Set who the message is to be sent from
            $mail->isSMTP();
            //Enable SMTP debugging
            // 0 = off (for production use)
            // 1 = client messages
            // 2 = client and server messages
            $mail->SMTPDebug = 2;
            //Set the hostname of the mail server
            $mail->Host = 'xxxxxxxxxxxxxx';
            //Set the SMTP port number - likely to be 25, 465 or 587
            $mail->Port = 587;
            $mail->SMTPSecure = "ssl";
            //Whether to use SMTP authentication
            $mail->SMTPAuth = true;
            //Username to use for SMTP authentication
            $mail->Username = 'xxxxxxxxxxxxxxxxx';
            //Password to use for SMTP authentication
            $mail->Password = 'xxxxxxxxxxxxxxxxx';
            $mail->setFrom('xxxxxxxxxxxxxxxxx', 'xxxxxxxxx');
            //Set an alternative reply-to address
            //$mail->addReplyTo('replyto@example.com', 'First Last');
            //Set who the message is to be sent to

            $mail->AddAddress("xxxxxxxxxxxxx");
            //Set the subject line
            //$mail->Subject = 'PHPMailer SMTP test';
            //Read an HTML message body from an external file, convert                      referenced images to embedded,
            //convert HTML into a basic plain-text alternative body
            //$mail->Body = 'Test';
            $mail->msgHTML("test");
            //Replace the plain text body with one created manually
            //$mail->AltBody = 'This is a plain-text message body';
            //Attach an image file
            //$mail->addAttachment('images/phpmailer_mini.png');
            //send the message, check for errors

            if (!$mail->send()) {
                echo "Mailer Error: " . $mail->ErrorInfo;
            } else {
                echo "Message sent!";
            }
            ?>
  • 写回答

1条回答 默认 最新

  • doupa2871 2018-03-22 21:32
    关注

    from https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    you must use

    port 465 with ssl

    or

    port 587 with tls

    you are currently using ssl with 587

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作