0
有人可以指出如何正确使用python中的imaplib进行搜索。电子邮件服务器是Microsoft Exchange - 似乎有问题,但我想从python/imaplib方面提供解决方案。 https://github.com/barbushin/php-imap/issues/128python3 imaplib搜索功能编码
我至今使用:
import imaplib
M = imaplib.IMAP4_SSL(host_name, port_name)
M.login(u, p)
M.select()
s_str = 'hello'
M.search(s_str)
而且我得到以下错误:
>>> M.search(s_str)
('NO', [b'[BADCHARSET (US-ASCII)] The specified charset is not supported.'])
您也可能想给IMAPClient一展身手。如果您将搜索条件作为unicode字符串传递,它会为您处理大部分搜索编码方面的问题。 项目:https://github.com/mjs/imapclient; 相关文档:http://imapclient.readthedocs.io/en/stable/#imapclient.IMAPClient.search –