imaplib.IMAP4.error: FETCH 命令错误: BAD [b'Command Error 10']

问题描述

我在尝试从已发送的项目中获取电子邮件时遇到错误,而当我从 INBox获取电子邮件时它运行良好。 有人有同样的问题吗?

谢谢大家。


import imapclient,pprint,pyzmail,re
import socket

out = {}



socket.getaddrinfo('127.0.0.1',8080)

imapObj = imapclient.IMAPClient('outlook.office365.com',ssl=True) # Access IMAP server

imapObj.login('email','pass') # Credintial logins

imapObj.select_folder('Sent Items',readonly=False) # Select inBox folder in IMAP server to search

#pprint.pprint(imapObj.list_folders())

UIDs = imapObj.search(['ALL']) # search from email to reutrn IDs

for i in UIDs:
    

    data = imapObj.fetch(UIDs,['BODY[]']) #UIDs to the fetch() method to obtain the email content

    message = pyzmail.PyzMessage.factory(data[i][b'BODY[]'])
    
    header = str(message.get_subject())
    
    print(header) 

错误和回溯如下:

回溯(最近一次调用最后一次): 文件“C:\Users\alaziza\Desktop\Python\sentCCverification.py”,第 24 行,在 data = imapObj.fetch(UIDs,'RFC822').items() #UIDs到fetch()方法获取邮件内容 文件“C:\Users\alaziza\AppData\Roaming\Python\python37\site-packages\imapclient\imapclient.py”,第 1367 行,在 fetch 中 typ,data = self._imap._command_complete("FETCH",tag) 文件“C:\Users\alaziza\AppData\Local\Programs\Thonny\lib\imaplib.py”,第 1027 行,_command_complete raise self.error('%s 命令错误%s %s' % (name,typ,data)) imaplib.IMAP4.error: FETCH 命令错误: BAD [b'Command Error。 10']

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)