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

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

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

    1. Python smtplib:Gmail 有效,但仅“有时"

      时间:2023-07-03
        <bdo id='TlBsV'></bdo><ul id='TlBsV'></ul>

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

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

            2. <tfoot id='TlBsV'></tfoot>
              <i id='TlBsV'><tr id='TlBsV'><dt id='TlBsV'><q id='TlBsV'><span id='TlBsV'><b id='TlBsV'><form id='TlBsV'><ins id='TlBsV'></ins><ul id='TlBsV'></ul><sub id='TlBsV'></sub></form><legend id='TlBsV'></legend><bdo id='TlBsV'><pre id='TlBsV'><center id='TlBsV'></center></pre></bdo></b><th id='TlBsV'></th></span></q></dt></tr></i><div id='TlBsV'><tfoot id='TlBsV'></tfoot><dl id='TlBsV'><fieldset id='TlBsV'></fieldset></dl></div>
                本文介绍了Python smtplib:Gmail 有效,但仅“有时"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我编写了一个简单的脚本来通过 Gmail SMTP 服务器发送电子邮件.代码如下:

                I wrote a simple script to send an email via the Gmail SMTP server. Here the code:

                import smtplib
                msg = 'Hello World!'
                server = smtplib.SMTP('smtp.gmail.com', 587) #port 465 or 587
                server.ehlo()
                server.starttls()
                server.ehlo()
                server.login('username@googlemail.com','password')
                server.sendmail('username@googlemail.com','username@googlemail.com', msg)
                server.close()
                

                有时它有效,有时我得到一个错误.原因是什么?我已将 Gmail 配置为接受不太安全的应用程序.如果发生错误,我会收到以下消息:

                Sometimes it works and sometimes I get an error. What is the reason for it? I have configured Gmail for accepting less secure apps. If the error occurs I get the following message:

                Traceback (most recent call last):
                  File "email.py", line 31, in <module>
                    server.login('username@googlemail.com','password')
                  File "/usr/lib/python3.5/smtplib.py", line 729, in login
                    raise last_exception
                  File "/usr/lib/python3.5/smtplib.py", line 720, in login
                    initial_response_ok=initial_response_ok)
                  File "/usr/lib/python3.5/smtplib.py", line 641, in auth
                    raise SMTPAuthenticationError(code, resp)
                smtplib.SMTPAuthenticationError: (534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbvQ
                5.7.14 DBMYWMukfjghdjfkghfjkhjkfhgjkdhgdfjkghekjghekjgndjkSm5lAOfEpP2Nt
                5.7.14 QihtNp5izjfghjjkjhgbhjbGHJVHJVjhvhjbhjbhjDZwhJFV-FiyvI-OGW
                5.7.14 jcpmHcQAcOR8e8G0zOfdugjhfdjd-sdfiugdsjfdsrthdfewrzjhg-shgv2HxmgWpZg3Z
                5.7.14 4G1ENiAlgiEnrkXyRbTG3frjZZdPg> Please log in via your web browser and
                5.7.14 then try again.
                5.7.14  Learn more at
                5.7.14  https://support.google.com/mail/answer/78754 g40sm24698383wrg.19 - gsmtp')
                

                我在互联网上找不到任何帮助.非常感谢您的每一个建议.

                I couldn't find any help on the internet. Many thanks in advance for every advice.

                推荐答案

                答案建议首先为不太安全的应用启用访问权限.如果这不起作用,您可以尝试访问该页面上提供的链接:https://www.google.com/accounts/DisplayUnlockCaptcha

                The answer recommends enabling access for less secure apps first. If that does not work you could try visiting the link, which is supplied on that page: https://www.google.com/accounts/DisplayUnlockCaptcha

                这可能会启用访问权限.

                This may enable access.

                这篇关于Python smtplib:Gmail 有效,但仅“有时"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:我正在尝试使用 web2py 和 gmail 发送电子邮件并使用 smtp 设置我已附加所有代码 下一篇:在 django 中使用 gmail smtp 服务器发送具有不同“发件人"电子邮件地址的电子邮件

                相关文章

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

                  • <bdo id='UaLxW'></bdo><ul id='UaLxW'></ul>

                  <tfoot id='UaLxW'></tfoot>
                  <legend id='UaLxW'><style id='UaLxW'><dir id='UaLxW'><q id='UaLxW'></q></dir></style></legend>

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