用法:
class imaplib.IMAP4(host='', port=IMAP4_PORT, timeout=None)
此類實現實際的 IMAP4 協議。初始化實例時,將創建連接並確定協議版本(IMAP4 或 IMAP4rev1)。如果未指定
host
,則使用''
(本地主機)。如果省略port
,則使用標準 IMAP4 端口 (143)。可選的timeout
參數指定連接嘗試的超時時間(以秒為單位)。如果 timeout 未給出或為 None,則使用全局默認套接字超時。IMAP4
類支持with
語句。當這樣使用時,IMAP4LOGOUT
命令會在with
語句退出時自動發出。例如:>>> from imaplib import IMAP4 >>> with IMAP4("domain.org") as M: ... M.noop() ... ('OK', [b'Nothing Accomplished. d25if65hy903weo.87'])
在 3.5 版中更改:支持
with
添加了聲明。在 3.9 版中更改:可選的
timeout
添加了參數。
相關用法
- Python imaplib.IMAP4.search用法及代碼示例
- Python imaplib.IMAP4.store用法及代碼示例
- Python image轉binary用法及代碼示例
- Python import__用法及代碼示例
- Python importlib.reload用法及代碼示例
- Python imp.reload用法及代碼示例
- Python OpenCV imdecode()用法及代碼示例
- Python importlib.util.LazyLoader.factory用法及代碼示例
- Python itertools.takewhile用法及代碼示例
- Python string isalnum()用法及代碼示例
- Python id()用法及代碼示例
- Python ipaddress.collapse_addresses用法及代碼示例
- Python ipaddress.IPv4Address.reverse_pointer用法及代碼示例
- Python io.text_encoding用法及代碼示例
- Python string isidentifier()用法及代碼示例
- Python numpy irr用法及代碼示例
- Python ipaddress.IPv4Address.__format__用法及代碼示例
- Python calendar isleap()用法及代碼示例
- Python itertools.compress用法及代碼示例
- Python math isclose()用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 imaplib.IMAP4。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。