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

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

      1. <legend id='L1xJ6'><style id='L1xJ6'><dir id='L1xJ6'><q id='L1xJ6'></q></dir></style></legend>
        <i id='L1xJ6'><tr id='L1xJ6'><dt id='L1xJ6'><q id='L1xJ6'><span id='L1xJ6'><b id='L1xJ6'><form id='L1xJ6'><ins id='L1xJ6'></ins><ul id='L1xJ6'></ul><sub id='L1xJ6'></sub></form><legend id='L1xJ6'></legend><bdo id='L1xJ6'><pre id='L1xJ6'><center id='L1xJ6'></center></pre></bdo></b><th id='L1xJ6'></th></span></q></dt></tr></i><div id='L1xJ6'><tfoot id='L1xJ6'></tfoot><dl id='L1xJ6'><fieldset id='L1xJ6'></fieldset></dl></div>
        <tfoot id='L1xJ6'></tfoot>
      2. 如何在没有身份验证的情况下直接向 SMTP 服务器发送邮件?

        时间:2023-07-02

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

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

                1. <i id='BkunA'><tr id='BkunA'><dt id='BkunA'><q id='BkunA'><span id='BkunA'><b id='BkunA'><form id='BkunA'><ins id='BkunA'></ins><ul id='BkunA'></ul><sub id='BkunA'></sub></form><legend id='BkunA'></legend><bdo id='BkunA'><pre id='BkunA'><center id='BkunA'></center></pre></bdo></b><th id='BkunA'></th></span></q></dt></tr></i><div id='BkunA'><tfoot id='BkunA'></tfoot><dl id='BkunA'><fieldset id='BkunA'></fieldset></dl></div>
                2. 本文介绍了如何在没有身份验证的情况下直接向 SMTP 服务器发送邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想通过直接连接到 smtp.gmail.com 直接从脚本向 Gmail 电子邮件帐户发送电子邮件.

                  I would like to send an email directly from a script to a Gmail email account, by connecting directly to smtp.gmail.com.

                  但是,我不希望脚本中包含 gmail 密码.根据我的阅读,Gmail 似乎需要验证才能发送任何邮件,包括发送给自己的用户.

                  However, I would prefer not to have the gmail password in the script. From what I have read, it appears that Gmail requires authentication before it will deliver any mail, including to its own users.

                  我的问题是,来自另一台 SMTP 服务器的邮件是如何传递的,因为该 SMTP 服务器没有 Gmail 凭据.Gmail 是否只需要对匿名"发件人进行身份验证,并且由于我的脚本在个人计算机上运行,因此需要更高的安全性?这是我正在运行的 python 脚本:

                  My question is, how is mail coming from another SMTP server ever delivered, since that SMTP server will not have Gmail credentials. Does Gmail only require authentication for "anonymous" senders, and since my script is running on a personal computer, it is subject to higher security? Here is the python script I am running:

                  import smtplib
                  import email
                  msg = email.message.Message()
                  msg["From"] = "user@gmail.com"
                  msg["To"] = "user@gmail.com"
                  msg["Subject"] = "Test message"
                  server = smtplib.SMTP("smtp.gmail.com",587)
                  server.starttls()
                  server.ehlo_or_helo_if_needed()
                  try:
                      failed = server.sendmail("user@gmail.com","user@gmail.com", msg.as_string())
                      server.close()
                  except Exception as e:
                      print(e)
                  

                  当我运行这个脚本时,输出是:

                  When I run this script, the output is:

                  (530, b'5.5.1 Authentication Required. Learn more at
                  5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 fw5sm21125889wib.0', 'user@gmail.com')
                  

                  我的问题是,外部 SMTP 服务器如何避免这个问题?他们所做的一切是否可以在本地脚本中复制,还是需要正确的反向 DNS 记录、SPF 记录等?

                  My question is, how do external SMTP servers avoid this problem? And is whatever they do replicable in a local script, or does it require correct reverse DNS records, SPF records, etc.?

                  推荐答案

                  你可以使用一些无需认证的外部 SMTP 服务器(或本地 SMTP),但是发送的邮件会被 Google 的垃圾邮件过滤器捕获,因为 msg["From"]@google.com,而实际的 SMTP 不是 smtp.gmail.com.

                  You can use some external SMTP servers without authentication (or a local SMTP), but the sent message will be caught by Google's spam filter because the msg["From"] is @google.com, while the actual SMTP is not smtp.gmail.com.

                  那些 SMTP 服务器也必须在 ISP 的 DNS 中有正确的反向区域,否则这个 smtp 将被 google 阻止.

                  Those SMTP servers also must have correct reverse zone in ISP's DNS and otherwise this smtp will be blocked by google.

                  这篇关于如何在没有身份验证的情况下直接向 SMTP 服务器发送邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 python smtplib 发送邮件错误 下一篇:错误:SMTPRecipientsRefused 553, '5.7.1 #while 在 django 中处理

                  相关文章

                3. <tfoot id='7vRrG'></tfoot>

                    <bdo id='7vRrG'></bdo><ul id='7vRrG'></ul>

                  <small id='7vRrG'></small><noframes id='7vRrG'>

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