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

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

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

      2. <legend id='nL9lz'><style id='nL9lz'><dir id='nL9lz'><q id='nL9lz'></q></dir></style></legend>
      3. 如何解决“无法与主机 smtp.gmail.com 建立连接"?

        How can I solve quot;Connection could not be established with host smtp.gmail.comquot;?(如何解决“无法与主机 smtp.gmail.com 建立连接?)

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

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

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

                  <bdo id='PyKF2'></bdo><ul id='PyKF2'></ul>
                • 本文介绍了如何解决“无法与主机 smtp.gmail.com 建立连接"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如果我确实在我的本地主机上发送电子邮件,它可以工作.没有错误

                  If I do send email on the my localhost, it works. No error

                  但我在登台服务器上尝试,它显示如下错误:

                  But I try on the staging server, it display error like this :

                  Swift_TransportException in StreamBuffer.php line 268:
                  Connection could not be established with host smtp.gmail.com [Connection timed out #110]
                  
                  in StreamBuffer.php line 268
                  at Swift_Transport_StreamBuffer->_establishSocketConnection() in StreamBuffer.php line 62
                  at Swift_Transport_StreamBuffer->initialize(array('protocol' => 'tcp', 'host' => 'smtp.gmail.com', 'port' => '587', 'timeout' => '30', 'blocking' => '1', 'tls' => true, 'type' => '1', 'stream_context_options' => array())) in AbstractSmtpTransport.php line 113
                  at Swift_Transport_AbstractSmtpTransport->start() in Mailer.php line 79
                  at Swift_Mailer->send(object(Swift_Message), array()) in Mailer.php line 395
                  at Mailer->sendSwiftMessage(object(Swift_Message)) in Mailer.php line 217
                  ...
                  

                  我的环境是这样的:

                  MAIL_DRIVER=smtp
                  MAIL_HOST=smtp.gmail.com
                  MAIL_PORT=587
                  MAIL_USERNAME=secret@gmail.com
                  MAIL_PASSWORD=secret
                  MAIL_ENCRYPTION=tls
                  

                  来自谷歌的一些参考(通过 Laravel 使用 gmail smtp:无法与主机 smtp.gmail.com 建立连接 [连接超时 #110]),我尝试了一些答案.我尝试将邮件端口和邮件加密更改为这样:

                  From some reference on the google (Using gmail smtp via Laravel: Connection could not be established with host smtp.gmail.com [Connection timed out #110]), I try some answer. I try change mail port and mail encryption to be like this :

                  MAIL_PORT=465
                  MAIL_ENCRYPTION=ssl
                  

                  没有用

                  我再次尝试更改:

                  MAIL_DRIVER=sendmail
                  

                  它也不起作用

                  我在这里 on:https://myaccount.google.com/lesssecureapps

                  都一样

                  我试试:

                  php artisan cache:clear
                  php artisan config:cache
                  

                  还是不行

                  我的服务器使用 gitlab、forge laravel 和数字海洋

                  My server using gitlab, forge laravel and digital ocean

                  以前在临时服务器上发送邮件可以,但是在我在 forge laravel 上重新安装存储库后,它现在无法正常工作

                  Previous send mail on the staging server worked, but after I re-install the repository on the forge laravel, it now does not work

                  我需要设置什么?

                  推荐答案

                  几天前我遇到了完全相同的问题,我到处搜索laracast stackoverflow和许多github问题,终于解决了问题.

                  Few days ago I've faced exactly the same problem and I've searched everywhere like laracast stackoverflow and many github issues and finally solve the problem.

                  你需要这样的配置,

                  MAIL_DRIVER=smtp
                  MAIL_HOST=smtp.gmail.com
                  MAIL_PORT=465
                  MAIL_USERNAME=youremail@gmail.com
                  MAIL_PASSWORD=yourpassword
                  MAIL_ENCRYPTION=ssl
                  

                  完成此设置后,您应该确保您的 google 帐户 2 步验证 已关闭,因为这增加了额外的安全层,这就是无法建立连接的原因.

                  After this setup you should make sure that your google account 2 step verification is turned off because this adds an extra layer of security that's why connection can't be established.

                  我认为这是谷歌最近添加的新功能.我以前进行过邮件配置,但最近相同的代码不起作用.

                  I think this is new feature added by google recently. I've working mail configuration before but recently same code doesn't work.

                  您可以转到您的 google 帐户,在那里您将看到 登录和安全 选项卡.单击它,您将在此处看到 2 步验证.然后你需要关闭它.然后我认为它会起作用.

                  You can go to your google account where you will see Sign-in and Security tab. Click on it then you will see 2 step verfication there. Then you need to turn off that. Then I think it'll work.

                  这件事对我有用,我希望它也对你有用.希望你能理解.

                  This thing worked for me I hope it'll work for you as well. I hope you understand.

                  这篇关于如何解决“无法与主机 smtp.gmail.com 建立连接"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 服务器发送电子邮件时,电子邮件进入垃圾邮件)
                  • <i id='K7Mfg'><tr id='K7Mfg'><dt id='K7Mfg'><q id='K7Mfg'><span id='K7Mfg'><b id='K7Mfg'><form id='K7Mfg'><ins id='K7Mfg'></ins><ul id='K7Mfg'></ul><sub id='K7Mfg'></sub></form><legend id='K7Mfg'></legend><bdo id='K7Mfg'><pre id='K7Mfg'><center id='K7Mfg'></center></pre></bdo></b><th id='K7Mfg'></th></span></q></dt></tr></i><div id='K7Mfg'><tfoot id='K7Mfg'></tfoot><dl id='K7Mfg'><fieldset id='K7Mfg'></fieldset></dl></div>
                    <legend id='K7Mfg'><style id='K7Mfg'><dir id='K7Mfg'><q id='K7Mfg'></q></dir></style></legend>
                  • <small id='K7Mfg'></small><noframes id='K7Mfg'>

                    1. <tfoot id='K7Mfg'></tfoot>
                        <bdo id='K7Mfg'></bdo><ul id='K7Mfg'></ul>
                            <tbody id='K7Mfg'></tbody>