On this page
imaplib.IMAP4_stream
Prev: imaplib.IMAP4_SSL | Up: imaplib | Next: imaplib.Int2AP
Rel: imaplib.IMAP4, imaplib.IMAP4_SSL, imaplib.Int2AP, imaplib.Internaldate2tuple
Ref: docs.python.org — imaplib.IMAP4_stream
Tags: #public #python3 #stdlib #imaplib
Import
import imaplib
from imaplib import IMAP4_stream
Signature & Overview
imaplib.IMAP4_stream(command)
IMAP4 client class over a stream Instantiate with: IMAP4_stream(command) "command" - a string that can be passed to subprocess.Popen()
Methods & Attributes
IMAP4_stream.abort(...)—IMAP4_stream.abortmethod/property.IMAP4_stream.append(self, mailbox, flags, date_time, message)— Append message to named mailbox.IMAP4_stream.authenticate(self, mechanism, authobject)— Authenticate command - requires response processing.IMAP4_stream.capability(self)— (typ, [data]) =.capability() Fetch capabilities list from server. IMAP4_stream.check(self)— Checkpoint mailbox on server.IMAP4_stream.close(self)— Close currently selected mailbox.IMAP4_stream.copy(self, message_set, new_mailbox)— Copy 'message_set' messages onto end of 'new_mailbox'.IMAP4_stream.create(self, mailbox)— Create new mailbox.IMAP4_stream.delete(self, mailbox)— Delete old mailbox.IMAP4_stream.deleteacl(self, mailbox, who)— Delete the ACLs (remove any rights) set for who on mailbox.IMAP4_stream.enable(self, capability)— Send an RFC5161 enable string to the server.IMAP4_stream.error(...)—IMAP4_stream.errormethod/property.IMAP4_stream.expunge(self)— Permanently remove deleted items from selected mailbox.IMAP4_stream.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_stream.file(...)—IMAP4_stream.filemethod/property.IMAP4_stream.getacl(self, mailbox)— Get the ACLs for a mailbox.IMAP4_stream.getannotation(self, mailbox, entry, attribute)— (typ, [data]) =.getannotation(mailbox, entry, attribute) Retrieve ANNOTATIONs. IMAP4_stream.getquota(self, root)— Get the quota root's resource usage and limits.IMAP4_stream.getquotaroot(self, mailbox)— Get the list of quota roots for the named mailbox.IMAP4_stream.idle(self, duration=None)— Return an iterable IDLE context manager producing untagged responses.IMAP4_stream.list(self, directory='', pattern='*')— List mailbox names in directory matching pattern.IMAP4_stream.login(self, user, password)— Identify client using plaintext password.IMAP4_stream.login_cram_md5(self, user, password)— Force use of CRAM-MD5 authentication.IMAP4_stream.logout(self)— Shutdown connection to server.IMAP4_stream.lsub(self, directory='', pattern='*')— List 'subscribed' mailbox names in directory matching pattern.IMAP4_stream.myrights(self, mailbox)— Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).IMAP4_stream.namespace(self)— Returns IMAP namespaces ala rfc2342 (typ, [data, ...]) =.namespace() IMAP4_stream.noop(self)— Send NOOP command.IMAP4_stream.open(self, host=None, port=None, timeout=None)— Setup a stream connection.IMAP4_stream.partial(self, message_num, message_part, start, length)— Fetch truncated part of a message.IMAP4_stream.print_log(self)—IMAP4_stream.print_logmethod/property.IMAP4_stream.proxyauth(self, user)— Assume authentication as "user".IMAP4_stream.read(self, size)— Read 'size' bytes from remote.IMAP4_stream.readline(self)— Read line from remote.IMAP4_stream.readonly(...)—IMAP4_stream.readonlymethod/property.IMAP4_stream.recent(self)— Return most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command.IMAP4_stream.rename(self, oldmailbox, newmailbox)— Rename old mailbox name to new.IMAP4_stream.response(self, code)— Return data for response 'code' if received, or None.IMAP4_stream.search(self, charset, *criteria)— Search mailbox for matching messages.IMAP4_stream.select(self, mailbox='INBOX', readonly=False)— Select a mailbox.
Usage
import imaplib
# Runs IMAP4 over stdin/stdout of a subprocess command (e.g., an SSH tunnel)
assert issubclass(imaplib.IMAP4_stream, imaplib.IMAP4)
Gotchas
- Passes
commandthroughsubprocess.Popen(shell=True): Never pass untrusted input intoIMAP4_stream.
REPL Inspect
from imaplib import IMAP4_stream
help(IMAP4_stream)
Linked from
- tuts/python3/stdlib_module/imaplib
- tuts/python3/stdlib_module/imaplib/IMAP4
- tuts/python3/stdlib_module/imaplib/IMAP4_SSL
- 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_SSL 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