• <tfoot id='i7GVA'></tfoot>

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

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

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

      1. smtplib 和 gmail - python 脚本问题

        时间:2023-07-02

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

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

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

                  问题描述

                  这是我的脚本:

                  #!/usr/bin/python
                  
                  import smtplib
                  msg = 'Hello world.'
                  
                  server = smtplib.SMTP('smtp.gmail.com',587) #port 465 or 587
                  server.ehlo()
                  server.starttls()
                  server.ehlo()
                  server.login('myname@gmail.com','mypass')
                  server.sendmail('myname@gmail.com','somename@somewhere.com',msg)
                  server.close()
                  

                  我只是想从我的 gmail 帐户发送一封电子邮件.由于 gmail 的要求,该脚本使用 starttls.我已经在两个网络主机上尝试过这个,1and1 和 webfaction.1and1 给了我一个连接被拒绝"的错误,webfaction 没有报告错误,但只是不发送电子邮件.我看不出脚本有什么问题,所以我认为它可能与网络主机有关.任何想法和意见将不胜感激.

                  I'm just trying to send an email from my gmail account. The script uses starttls because of gmail's requirement. I've tried this on two web hosts, 1and1 and webfaction. 1and1 gives me a 'connection refused' error and webfaction reports no error but just doesn't send the email. I can't see anything wrong with the script, so I'm thinking it might be related to the web hosts. Any thoughts and comments would be much appreciated.

                  我打开了调试模式.从输出来看,它似乎成功发送了消息……我只是没有收到它.

                  I turned on debug mode. From the output, it looks like it sent the message successfully...I just never receive it.

                  send: 'ehlo web65.webfaction.com
                  '
                  reply: '250-mx.google.com at your service, [174.133.21.84]
                  '
                  reply: '250-SIZE 35651584
                  '
                  reply: '250-8BITMIME
                  '
                  reply: '250-STARTTLS
                  '
                  reply: '250-ENHANCEDSTATUSCODES
                  '
                  reply: '250 PIPELINING
                  '
                  reply: retcode (250); Msg: mx.google.com at your service, [174.133.21.84]
                  SIZE 35651584
                  8BITMIME
                  STARTTLS
                  ENHANCEDSTATUSCODES
                  PIPELINING
                  send: 'STARTTLS
                  '
                  reply: '220 2.0.0 Ready to start TLS
                  '
                  reply: retcode (220); Msg: 2.0.0 Ready to start TLS
                  send: 'ehlo web65.webfaction.com
                  '
                  reply: '250-mx.google.com at your service, [174.133.21.84]
                  '
                  reply: '250-SIZE 35651584
                  '
                  reply: '250-8BITMIME
                  '
                  reply: '250-AUTH LOGIN PLAIN
                  '
                  reply: '250-ENHANCEDSTATUSCODES
                  '
                  reply: '250 PIPELINING
                  '
                  reply: retcode (250); Msg: mx.google.com at your service, [174.133.21.84]
                  SIZE 35651584
                  8BITMIME
                  AUTH LOGIN PLAIN
                  ENHANCEDSTATUSCODES
                  PIPELINING
                  send: 'AUTH PLAIN *****
                  '
                  reply: '235 2.7.0 Accepted
                  '
                  reply: retcode (235); Msg: 2.7.0 Accepted
                  send: 'mail FROM:<myname@gmail.com> size=12
                  '
                  reply: '250 2.1.0 OK 4sm652580yxq.48
                  '
                  reply: retcode (250); Msg: 2.1.0 OK 4sm652580yxq.48
                  send: 'rcpt TO:<myname@gmail.com>
                  '
                  reply: '250 2.1.5 OK 4sm652580yxq.48
                  '
                  reply: retcode (250); Msg: 2.1.5 OK 4sm652580yxq.48
                  send: 'data
                  '
                  reply: '354  Go ahead 4sm652580yxq.48
                  '
                  reply: retcode (354); Msg: Go ahead 4sm652580yxq.48
                  data: (354, 'Go ahead 4sm652580yxq.48')
                  send: 'Hello world.
                  .
                  '
                  reply: '250 2.0.0 OK 1240421143 4sm652580yxq.48
                  '
                  reply: retcode (250); Msg: 2.0.0 OK 1240421143 4sm652580yxq.48
                  data: (250, '2.0.0 OK 1240421143 4sm652580yxq.48')
                  

                  推荐答案

                  我认为 GMail SMTP 服务器会对您连接的 IP 地址进行反向 DNS 查找,如果找不到域,则拒绝连接.这是为了避免垃圾邮件发送者将他们的 SMTP 服务器用作开放中继.

                  I think that the GMail SMTP server does a reverse DNS lookup on the IP address that you connect from, and refuses the connection if no domain can be found. This is to avoid spammer from using their SMTP server as an open relay.

                  这篇关于smtplib 和 gmail - python 脚本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 python smtplib 转发电子邮件 下一篇:服务器不支持 SMTP AUTH 扩展

                  相关文章

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

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

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

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