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

    1. <small id='4v2ce'></small><noframes id='4v2ce'>

        使用 imaplib 在 gmail 中删除电子邮件时出现问题

        时间:2023-10-20
          <bdo id='Yv329'></bdo><ul id='Yv329'></ul>

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

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

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

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

                  本文介绍了使用 imaplib 在 gmail 中删除电子邮件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我尝试从收件箱文件夹中删除邮件,一切正常,但是当我切换到所有邮件文件夹时,删除不起作用.expunge() 方法返回 ('OK', [None]) 并且消息没有被删除:

                  I try to remove message from inbox folder and all alright, but when i switched to All Mail folder the removing does not work. expunge() method returns ('OK', [None]) and message was not removed:

                  >>>import imaplib
                  >>>server = imaplib.IMAP4_SSL('imap.gmail.com','993')
                  >>>server.login('likvidator89@gmail.com','Password')
                  >>>server.select('inbox')
                  >>>for i in server.search(None,'all')[1][0].split():
                  ...    print i+"
                  "+server.fetch(i,'(BODY[HEADER.FIELDS (Subject)])')[1][0][1]
                  ...
                  #  that how i know what UID hame my message? I select by subject
                  #....
                  #28
                  #Subject: 1 Question Has 1 Answer - Stack Overflow
                  #
                  #
                  #29
                  #Subject: 2222222222
                  #...
                  >>>server.store(29,'+FLAGS','\Deleted')
                  #('OK', ['29 (FLAGS (\Seen \Deleted))'])
                  >>>server.expunge()
                  #('OK', ['29'])
                  >>> server.select('[Gmail]/All Mail')
                  ('OK', ['47'])
                  >>> for i in server.search(None,'all')[1][0].split():
                  ...  print i+"
                  "+server.fetch(i,'(BODY[HEADER.FIELDS (Subject)])')[1][0][1]
                  ... 
                  #....
                  #
                  #46
                  #Subject: 2222222222
                  #
                  #
                  #47
                  #Subject: 3333333333333333
                  #
                  #....
                  >>> server.store(47,'+FLAGS','\Deleted')
                  ('OK', ['47 (FLAGS (\Seen \Deleted))'])
                  >>> server.expunge()
                  ('OK', [None])
                  

                  推荐答案

                  正如 gmail 博客站点,Google 的 IMAP 实现有点不同.当您按照说明获取更常用的语义时,是否有帮助?

                  As it says on the gmail blog site, Google's implementation of IMAP is a bit different. When you follow the instructions for getting more usual semantics, does it help?

                  还有一些比较晦涩的那些想要的人的选择让 Gmail 的 IMAP 工作起来更像传统 IMAP 提供商:您可以关闭自动清除或垃圾箱当它们不再存在时的消息通过 IMAP 可见.

                  There are also some more obscure options for those of you who want to make Gmail's IMAP work more like traditional IMAP providers: you can turn off auto-expunge or trash messages when they're no longer visible through IMAP.

                  IMAP 协议允许消息被标记为删除,一种消息仍然存在的边缘状态存在于文件夹中,但预定下次文件夹被删除时删除.在我们的标准 IMAP实现,当你标记一个邮件已删除,Gmail 不允许它停留在那个状态——它删除(或自动删除)它从文件夹中马上.如果你想要两阶段启用后删除进程这个实验室,只需选择不要自动删除邮件'下中的转发和 POP/IMAP"选项卡设置.

                  The IMAP protocol allows messages to be marked for deletion, a sort of limbo state where a message is still present in the folder but slated to be deleted the next time the folder is expunged. In our standard IMAP implementation, when you mark a message as deleted, Gmail doesn't let it linger in that state -- it deletes (or auto-expunges) it from the folder right away. If you want the two-stage delete process, after you've enabled this Lab, just select 'Do not automatically expunge messages' under the 'Forwarding and POP/IMAP' tab in Settings.

                  同样,大多数 IMAP 系统不支持分享 Gmail 的归档理念消息(发送消息到[Gmail]/所有邮件文件夹而不是[Gmail]/垃圾箱).如果你愿意已删除的消息不保留在任何其他可见的 IMAP 文件夹被发送到[Gmail]/垃圾箱,高级 IMAP控件可让您设置首选项这边走.在IMAP 访问:"中转发和POP/IMAP"选项卡,找到当消息从最后一个被删除可见 IMAP 文件夹:' 选项.选择将邮件移至 Gmail 垃圾箱."如果你想迈出一步此外,您可以选择立即永远删除这条消息.'

                  Similarly, most IMAP systems don't share Gmail's concept of archiving messages (sending messages to the [Gmail]/All Mail folder rather than [Gmail]/Trash). If you'd prefer that deleted messages not remaining in any other visible IMAP folders are sent to [Gmail]/Trash instead, Advanced IMAP Controls lets you set your preferences this way. In the 'IMAP Access:' section of the 'Forwarding and POP/IMAP' tab, find the 'When a message is deleted from the last visible IMAP folder:' option. Select 'Move the message to the Gmail Trash.' If you want to take it one step further, you can select 'Immediately delete the message forever.'

                  这篇关于使用 imaplib 在 gmail 中删除电子邮件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Python Gmail API'不是 JSON 可序列化的' 下一篇:Python:Google API - 从消息中获取 mimeTypes

                  相关文章

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

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

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

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