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

      <small id='5HZrd'></small><noframes id='5HZrd'>

      <i id='5HZrd'><tr id='5HZrd'><dt id='5HZrd'><q id='5HZrd'><span id='5HZrd'><b id='5HZrd'><form id='5HZrd'><ins id='5HZrd'></ins><ul id='5HZrd'></ul><sub id='5HZrd'></sub></form><legend id='5HZrd'></legend><bdo id='5HZrd'><pre id='5HZrd'><center id='5HZrd'></center></pre></bdo></b><th id='5HZrd'></th></span></q></dt></tr></i><div id='5HZrd'><tfoot id='5HZrd'></tfoot><dl id='5HZrd'><fieldset id='5HZrd'></fieldset></dl></div>
    1. <tfoot id='5HZrd'></tfoot>
    2. Python:发送电子邮件时,总是在子句中被阻止:smtpserver = smtplib.SMTP("smt

      Python: when sending email, always blocked in the clause: smtpserver = smtplib.SMTP(quot;smtp.gmail.comquot;,587)(Python:发送电子邮件时,总是在子句中被阻止:smtpserver = smtplib.SMTP(smtp.gmail.com,587))

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

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

        2. <tfoot id='rjc6C'></tfoot>
        3. <i id='rjc6C'><tr id='rjc6C'><dt id='rjc6C'><q id='rjc6C'><span id='rjc6C'><b id='rjc6C'><form id='rjc6C'><ins id='rjc6C'></ins><ul id='rjc6C'></ul><sub id='rjc6C'></sub></form><legend id='rjc6C'></legend><bdo id='rjc6C'><pre id='rjc6C'><center id='rjc6C'></center></pre></bdo></b><th id='rjc6C'></th></span></q></dt></tr></i><div id='rjc6C'><tfoot id='rjc6C'></tfoot><dl id='rjc6C'><fieldset id='rjc6C'></fieldset></dl></div>
            <tbody id='rjc6C'></tbody>
              • <bdo id='rjc6C'></bdo><ul id='rjc6C'></ul>
                本文介绍了Python:发送电子邮件时,总是在子句中被阻止:smtpserver = smtplib.SMTP("smtp.gmail.com",587)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在编写一个 Python 程序来发送电子邮件.但是每次执行子句时:

                I am writing a Python program to send an email. But every time when executing the clause:

                smtpserver = smtplib.SMTP("smtp.gmail.com",587)
                

                它会在这里阻塞,一直保持执行状态,没有任何提示和错误.我不知道为什么.谁能帮助我?

                it will block here and always stay the executing status without any prompts and errors. I don't know why. And can anyone help me?

                代码如下:导入smtplib

                The code is as following: import smtplib

                to = 'toemail@gmail.com'
                gmail_user = 'user@gmail.com'
                gmail_pwd = 'password'
                smtpserver = smtplib.SMTP("smtp.gmail.com",587)
                smtpserver.ehlo()
                smtpserver.starttls()
                smtpserver.ehlo
                smtpserver.login(gmail_user, gmail_pwd)
                header = 'To:' + to + '
                ' + 'From: ' + gmail_user + '
                ' + 'Subject:testing 
                '
                print header
                msg = header + '
                 this is test msg from mkyong.com 
                
                '
                smtpserver.sendmail(gmail_user, to, msg)
                print 'done!'
                smtpserver.close()
                

                推荐答案

                也许我迟到了 4 年,但这对我有用,可能对其他人有帮助!

                Maybe I am 4 years late, but this is what worked for me and might help someone else!

                server = smtplib.SMTP("smtp.gmail.com", 587, None, 30)
                

                这篇关于Python:发送电子邮件时,总是在子句中被阻止:smtpserver = smtplib.SMTP("smtp.gmail.com",587)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                env: python: No such file or directory(env: python: 没有这样的文件或目录)
                How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                <tfoot id='YCOS4'></tfoot>

                    <tbody id='YCOS4'></tbody>

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

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

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