On this page
imaplib.IMAP4_SSL
Prev: imaplib.IMAP4 | Up: imaplib | Next: imaplib.IMAP4_stream
Rel: imaplib.IMAP4, imaplib.IMAP4_stream, imaplib.Int2AP, imaplib.Internaldate2tuple
Ref: docs.python.org — imaplib.IMAP4_SSL
Tags: #public #python3 #stdlib #imaplib
Import
import imaplib
from imaplib import IMAP4_SSL
Signature & Overview
imaplib.IMAP4_SSL(host='', port=993, *, ssl_context=None, timeout=None)
IMAP4 client class over SSL connection Instantiate with: IMAP4_SSL([host[, port[, ssl_context[, timeout=None]]]]) host - host's name (default: localhost);
Methods & Attributes
IMAP4_SSL.abort(...)—IMAP4_SSL.abortmethod/property.IMAP4_SSL.append(self, mailbox, flags, date_time, message)— Append message to named mailbox.IMAP4_SSL.authenticate(self, mechanism, authobject)— Authenticate command - requires response processing.IMAP4_SSL.capability(self)— (typ, [data]) =.capability() Fetch capabilities list from server. IMAP4_SSL.check(self)— Checkpoint mailbox on server.IMAP4_SSL.close(self)— Close currently selected mailbox.IMAP4_SSL.copy(self, message_set, new_mailbox)— Copy 'message_set' messages onto end of 'new_mailbox'.IMAP4_SSL.create(self, mailbox)— Create new mailbox.IMAP4_SSL.delete(self, mailbox)— Delete old mailbox.IMAP4_SSL.deleteacl(self, mailbox, who)— Delete the ACLs (remove any rights) set for who on mailbox.IMAP4_SSL.enable(self, capability)— Send an RFC5161 enable string to the server.IMAP4_SSL.error(...)—IMAP4_SSL.errormethod/property.IMAP4_SSL.expunge(self)— Permanently remove deleted items from selected mailbox.IMAP4_SSL.fetch(self, message_set, message_parts)— (typ, [data, ...]) =.fetch(message_set, message_parts) 'message_parts' should be a string of selected parts enclosed in parentheses, eg: "(UID BODY[TEXT])". IMAP4_SSL.file(...)—IMAP4_SSL.filemethod/property.IMAP4_SSL.getacl(self, mailbox)— Get the ACLs for a mailbox.IMAP4_SSL.getannotation(self, mailbox, entry, attribute)— (typ, [data]) =.getannotation(mailbox, entry, attribute) Retrieve ANNOTATIONs. IMAP4_SSL.getquota(self, root)— Get the quota root's resource usage and limits.IMAP4_SSL.getquotaroot(self, mailbox)— Get the list of quota roots for the named mailbox.IMAP4_SSL.idle(self, duration=None)— Return an iterable IDLE context manager producing untagged responses.IMAP4_SSL.list(self, directory='', pattern='*')— List mailbox names in directory matching pattern.IMAP4_SSL.login(self, user, password)— Identify client using plaintext password.IMAP4_SSL.login_cram_md5(self, user, password)— Force use of CRAM-MD5 authentication.IMAP4_SSL.logout(self)— Shutdown connection to server.IMAP4_SSL.lsub(self, directory='', pattern='*')— List 'subscribed' mailbox names in directory matching pattern.IMAP4_SSL.myrights(self, mailbox)— Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).IMAP4_SSL.namespace(self)— Returns IMAP namespaces ala rfc2342 (typ, [data, ...]) =.namespace() IMAP4_SSL.noop(self)— Send NOOP command.IMAP4_SSL.open(self, host='', port=993, timeout=None)— Setup connection to remote server on "host:port".IMAP4_SSL.partial(self, message_num, message_part, start, length)— Fetch truncated part of a message.IMAP4_SSL.print_log(self)—IMAP4_SSL.print_logmethod/property.IMAP4_SSL.proxyauth(self, user)— Assume authentication as "user".IMAP4_SSL.read(self, size)— Read 'size' bytes from remote.IMAP4_SSL.readline(self)— Read line from remote.IMAP4_SSL.readonly(...)—IMAP4_SSL.readonlymethod/property.IMAP4_SSL.recent(self)— Return most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command.IMAP4_SSL.rename(self, oldmailbox, newmailbox)— Rename old mailbox name to new.IMAP4_SSL.response(self, code)— Return data for response 'code' if received, or None.IMAP4_SSL.search(self, charset, *criteria)— Search mailbox for matching messages.IMAP4_SSL.select(self, mailbox='INBOX', readonly=False)— Select a mailbox.
Usage
import imaplib
# Encrypted IMAP4 client over TLS (port 993):
# with imaplib.IMAP4_SSL("imap.example.com", 993, timeout=30) as client: ...
assert issubclass(imaplib.IMAP4_SSL, imaplib.IMAP4)
Gotchas
- Always pass
timeout=and use UID commands (client.uid("search", ...),client.uid("fetch", ...)) instead of shifting sequence numbers.
REPL Inspect
from imaplib import IMAP4_SSL
help(IMAP4_SSL)
Linked from
- tuts/python3/stdlib_module/imaplib
- tuts/python3/stdlib_module/imaplib/IMAP4
- tuts/python3/stdlib_module/imaplib/IMAP4_stream
- tuts/python3/stdlib_module/imaplib/Int2AP
- tuts/python3/stdlib_module/imaplib/Internaldate2tuple
- tuts/python3/stdlib_module/imaplib/ParseFlags
- tuts/python3/stdlib_module/imaplib/Time2Internaldate
Related notes
- tuts/python3/stdlib_module/imaplib/IMAP4 Linked here; links to this page; shared tags: #imaplib, #stdlib
- tuts/python3/stdlib_module/imaplib/IMAP4_stream Linked here; links to this page; shared tags: #imaplib, #stdlib
- tuts/python3/stdlib_module/imaplib/Int2AP Linked here; links to this page; shared tags: #imaplib, #stdlib
- tuts/python3/stdlib_module/imaplib/Internaldate2tuple Linked here; links to this page; shared tags: #imaplib, #stdlib
- tuts/python3/stdlib_module/imaplib Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/imaplib/ParseFlags links to this page; shared tags: #imaplib, #stdlib
- tuts/python3/stdlib_module/imaplib/Time2Internaldate links to this page; shared tags: #imaplib, #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib