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 –