我在使用 imap 时遇到了一些问题。我要做的是编写一个脚本,该脚本将使用 imap 连接到我们的语音邮件服务器并下载所有消息。我已经能够使用个人帐户登录,但是当我尝试使用“proxyauth”以管理员身份登录并代理到另一个订阅者的邮箱时,我收到以下错误:
“imaplib.error:PROXYAUTH 命令错误:BAD ['Unrecognized command']”
这是我正在使用的代码:
c = imaplib.IMAP4("x.x.x.x")
c.login_cram_md5("admin", "******")
c.proxyauth("7001")
type, data = c.select()
try:
c.select('INBOX', readonly=True)
for i in c.search(None, 'All')[1][0].split():
print "\n===================================="
print "Reading Message: " + str(i) + "..."
print "====================================\n"
typ, msg_data = c.fetch(str(i), '(RFC822)')
for response_part in msg_data:
if isinstance(response_part, tuple):
print email.message_from_string(str(msg_data[0][1]))
finally:
try:
c.close()
except:
pass
c.logout()
任何关于我可能做错的想法将不胜感激!