twisted.mail.imap4.IMAP4Client(basic.LineReceiver, policies.TimeoutMixin)
class documentationtwisted.mail.imap4
View Source
(View In Hierarchy)
Implements interfaces: twisted.mail.interfaces.IMailboxIMAPListener
IMAP4 client protocol implementation
Instance Variable | state | A string representing the state the connection is currently in. |
Method | __init__ | Undocumented |
Method | registerAuthenticator | Register a new form of authentication |
Method | rawDataReceived | Override this for when raw data is received. |
Method | connectionMade | Called when a connection is made. |
Method | connectionLost | We are no longer connected |
Method | lineReceived | Attempt to parse a single line from the server. |
Method | timeoutConnection | Called when the connection times out. |
Method | messageFile | Create a file to which an incoming message may be written. |
Method | makeTag | Undocumented |
Method | dispatchCommand | Undocumented |
Method | response_UNAUTH | Undocumented |
Method | response_AUTH | Undocumented |
Method | sendCommand | Undocumented |
Method | getCapabilities | Request the capabilities available on this server. |
Method | logout | Inform the server that we are done with the connection. |
Method | noop | Perform no operation. |
Method | startTLS | Initiates a 'STARTTLS' request and negotiates the TLS / SSL Handshake. |
Method | authenticate | Attempt to enter the authenticated state with the server |
Method | login | Authenticate with the server using a username and password |
Method | serverGreeting | Called when the server has sent us a greeting. |
Method | namespace | Retrieve information about the namespaces available to this account |
Method | select | Select a mailbox |
Method | examine | Select a mailbox in read-only mode |
Method | create | Create a new mailbox on the server |
Method | delete | Delete a mailbox |
Method | rename | Rename a mailbox |
Method | subscribe | Add a mailbox to the subscription list |
Method | unsubscribe | Remove a mailbox from the subscription list |
Method | list | List a subset of the available mailboxes |
Method | lsub | List a subset of the subscribed available mailboxes |
Method | status | Retrieve the status of the given mailbox |
Method | append | Add the given message to the given mailbox. |
Method | check | Tell the server to perform a checkpoint |
Method | close | Return the connection to the Authenticated state. |
Method | expunge | Return the connection to the Authenticate state. |
Method | search | Search messages in the currently selected mailbox |
Method | fetchUID | Retrieve the unique identifier for one or more messages |
Method | fetchFlags | Retrieve the flags for one or more messages |
Method | fetchInternalDate | Retrieve the internal date associated with one or more messages |
Method | fetchEnvelope | Retrieve the envelope data for one or more messages |
Method | fetchBodyStructure | Retrieve the structure of the body of one or more messages |
Method | fetchSimplifiedBody | Retrieve the simplified body structure of one or more messages |
Method | fetchMessage | Retrieve one or more entire messages |
Method | fetchHeaders | Retrieve headers of one or more messages |
Method | fetchBody | Retrieve body text of one or more messages |
Method | fetchSize | Retrieve the size, in octets, of one or more messages |
Method | fetchFull | Retrieve several different fields of one or more messages |
Method | fetchAll | Retrieve several different fields of one or more messages |
Method | fetchFast | Retrieve several different fields of one or more messages |
Method | fetchSpecific | Retrieve a specific section of one or more messages |
Method | setFlags | Set the flags for one or more messages. |
Method | addFlags | Add to the set flags for one or more messages. |
Method | removeFlags | Remove from the set flags for one or more messages. |
Method | copy | Copy the specified messages to the specified mailbox. |
Method | modeChanged | Override me |
Method | flagsChanged | Override me |
Method | newMessages | Override me |
Method | _setupForLiteral | Undocumented |
Method | _regularDispatch | Undocumented |
Method | _defaultHandler | Undocumented |
Method | _flushQueue | Undocumented |
Method | _extraInfo | Undocumented |
Method | __cbCapabilities | Undocumented |
Method | __cbLogout | Undocumented |
Method | __cbNoop | Undocumented |
Method | __cbAuthenticate | Undocumented |
Method | __cbContinueAuth | Undocumented |
Method | __cbAuthTLS | Undocumented |
Method | _getContextFactory | Undocumented |
Method | __cbLoginCaps | Undocumented |
Method | _startedTLS | Undocumented |
Method | __cbLoginTLS | Undocumented |
Method | __ebLoginTLS | Undocumented |
Method | __cbNamespace | Undocumented |
Method | _intOrRaise | Parse value as an integer and return the result or raise IllegalServerResponse
with phrase as an argument if value cannot be
parsed as an integer. |
Method | __cbSelect | Handle lines received in response to a SELECT or EXAMINE command. |
Method | __cbList | Undocumented |
Method | __cbStatus | Undocumented |
Method | __cbContinueAppend | Undocumented |
Method | __cbFinishAppend | Undocumented |
Method | __cbExpunge | Undocumented |
Method | __cbSearch | Undocumented |
Method | _parseFetchPairs | Given the result of parsing a single FETCH response, construct a
dict mapping response keys to response values. |
Method | _cbFetch | Undocumented |
Method | _fetch | Undocumented |
Method | _store | Undocumented |
Inherited from TimeoutMixin:
Class Variable | timeOut | The number of seconds after which to timeout the connection. |
Method | callLater | Wrapper around reactor.callLater
for test purpose. |
Method | resetTimeout | Reset the timeout count down. |
Method | setTimeout | Change the timeout period |
Method | __timedOut | Undocumented |
Inherited from TimeoutMixin:
Class Variable | timeOut | The number of seconds after which to timeout the connection. |
Method | callLater | Wrapper around reactor.callLater
for test purpose. |
Method | resetTimeout | Reset the timeout count down. |
Method | setTimeout | Change the timeout period |
Method | __timedOut | Undocumented |
Inherited from TimeoutMixin:
Class Variable | timeOut | The number of seconds after which to timeout the connection. |
Method | callLater | Wrapper around reactor.callLater
for test purpose. |
Method | resetTimeout | Reset the timeout count down. |
Method | setTimeout | Change the timeout period |
Method | __timedOut | Undocumented |
Inherited from TimeoutMixin:
Class Variable | timeOut | The number of seconds after which to timeout the connection. |
Method | callLater | Wrapper around reactor.callLater
for test purpose. |
Method | resetTimeout | Reset the timeout count down. |
Method | setTimeout | Change the timeout period |
Method | __timedOut | Undocumented |
Inherited from TimeoutMixin:
Class Variable | timeOut | The number of seconds after which to timeout the connection. |
Method | callLater | Wrapper around reactor.callLater
for test purpose. |
Method | resetTimeout | Reset the timeout count down. |
Method | setTimeout | Change the timeout period |
Method | __timedOut | Undocumented |
Register a new form of authentication
When invoking the authenticate() method of IMAP4Client, the first matching authentication scheme found will be used. The ordering is that in which the server lists support authentication schemes.
Parameters | auth | The object to use to perform the client side of this authentication scheme. (type: Implementor of IClientAuthentication ) |
Called when a connection is made.
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
Attempt to parse a single line from the server.
Parameters | line | The line from the server, without the line delimiter. (type: bytes ) |
Raises | IllegalServerResponse | If the line or some part of the line does not represent an allowed message from the server at this time. |
Called when the connection times out.
Override to define behavior other than dropping the connection.
Create a file to which an incoming message may be written.
Parameters | octets | The number of octets which will be written to the file (type: int ) |
Returns | A file-like object (type: Any object which implements write(string) and seek(int,
int) ) |
Request the capabilities available on this server.
This command is allowed in any state of connection.
Parameters | useCache | Specify whether to use the capability-cache or to re-retrieve the
capabilities from the server. Server capabilities should never change, so
for normal use, this flag should never be false. (type: bool ) |
Returns | A deferred whose callback will be invoked with a dictionary mapping
capability types to lists of supported mechanisms, or to None if a support
list is not applicable. (type: Deferred ) |
Inform the server that we are done with the connection.
This command is allowed in any state of connection.
Returns | A deferred whose callback will be invoked with None when the proper server
acknowledgement has been received. (type: Deferred ) |
Perform no operation.
This command is allowed in any state of connection.
Returns | A deferred whose callback will be invoked with a list of untagged status
updates the server responds with. (type: Deferred ) |
Initiates a 'STARTTLS' request and negotiates the TLS / SSL Handshake.
Parameters | contextFactory | The TLS / SSL Context Factory to leverage. If the contextFactory is None
the IMAP4Client will either use the current TLS / SSL Context Factory or
attempt to create a new one. (type: ssl.ClientContextFactory ) |
Returns | A Deferred which fires when the transport has been secured according to the given contextFactory, or which fails if the transport cannot be secured. |
Attempt to enter the authenticated state with the server
This command is allowed in the Non-Authenticated state.
Returns | A deferred whose callback is invoked if the authentication succeeds and
whose errback will be invoked otherwise. (type: Deferred ) |
Authenticate with the server using a username and password
This command is allowed in the Non-Authenticated state. If the server supports the STARTTLS capability and our transport supports TLS, TLS is negotiated before the login command is issued.
A more secure way to log in is to use startTLS
or
authenticate
or both.
Parameters | username | The username to log in with (type: str ) |
password | The password to log in with (type: str ) | |
Returns | A deferred whose callback is invoked if login is successful and whose
errback is invoked otherwise. (type: Deferred ) |
Called when the server has sent us a greeting.
Parameters | caps | Capabilities the server advertised in its greeting. (type: dict ) |
Retrieve information about the namespaces available to this account
This command is allowed in the Authenticated and Selected states.
Returns | A deferred whose callback is invoked with namespace information. An
example of this information is:
[[['', '/']], [], []] which indicates a single personal namespace called '' with '/' as its hierarchical delimiter, and no shared or user namespaces. (type:Deferred ) |
Select a mailbox
This command is allowed in the Authenticated and Selected states.
Parameters | mailbox | The name of the mailbox to select (type: str ) |
Returns | A deferred whose callback is invoked with mailbox information if the select
is successful and whose errback is invoked otherwise. Mailbox information
consists of a dictionary with the following keys and values:
FLAGS: A list of strings containing the flags settable on messages in this mailbox. EXISTS: An integer indicating the number of messages in this mailbox. RECENT: An integer indicating the number of "recent" messages in this mailbox. UNSEEN: The message sequence number (an integer) of the first unseen message in the mailbox. PERMANENTFLAGS: A list of strings containing the flags that can be permanently set on messages in this mailbox. UIDVALIDITY: An integer uniquely identifying this mailbox.(type: Deferred ) |
Select a mailbox in read-only mode
This command is allowed in the Authenticated and Selected states.
Parameters | mailbox | The name of the mailbox to examine (type: str ) |
Returns | A deferred whose callback is invoked with mailbox information if the
examine is successful and whose errback is invoked otherwise. Mailbox
information consists of a dictionary with the following keys and values:
'FLAGS': A list of strings containing the flags settable on messages in this mailbox. 'EXISTS': An integer indicating the number of messages in this mailbox. 'RECENT': An integer indicating the number of "recent" messages in this mailbox. 'UNSEEN': An integer indicating the number of messages not flagged \Seen in this mailbox. 'PERMANENTFLAGS': A list of strings containing the flags that can be permanently set on messages in this mailbox. 'UIDVALIDITY': An integer uniquely identifying this mailbox.(type: Deferred ) |
Parse value
as an integer and return the result or raise IllegalServerResponse
with phrase
as an argument if value
cannot be
parsed as an integer.
Handle lines received in response to a SELECT or EXAMINE command.
See RFC 3501, section 6.3.1.
Create a new mailbox on the server
This command is allowed in the Authenticated and Selected states.
Parameters | name | The name of the mailbox to create. (type: str ) |
Returns | A deferred whose callback is invoked if the mailbox creation is successful
and whose errback is invoked otherwise. (type: Deferred ) |
Delete a mailbox
This command is allowed in the Authenticated and Selected states.
Parameters | name | The name of the mailbox to delete. (type: str ) |
Returns | A deferred whose calblack is invoked if the mailbox is deleted successfully
and whose errback is invoked otherwise. (type: Deferred ) |
Rename a mailbox
This command is allowed in the Authenticated and Selected states.
Parameters | oldname | The current name of the mailbox to rename. (type: str ) |
newname | The new name to give the mailbox. (type: str ) | |
Returns | A deferred whose callback is invoked if the rename is successful and whose
errback is invoked otherwise. (type: Deferred ) |
Add a mailbox to the subscription list
This command is allowed in the Authenticated and Selected states.
Parameters | name | The mailbox to mark as 'active' or 'subscribed' (type: str ) |
Returns | A deferred whose callback is invoked if the subscription is successful and
whose errback is invoked otherwise. (type: Deferred ) |
Remove a mailbox from the subscription list
This command is allowed in the Authenticated and Selected states.
Parameters | name | The mailbox to unsubscribe (type: str ) |
Returns | A deferred whose callback is invoked if the unsubscription is successful
and whose errback is invoked otherwise. (type: Deferred ) |
List a subset of the available mailboxes
This command is allowed in the Authenticated and Selected states.
Parameters | reference | The context in which to interpret wildcard (type: str ) |
wildcard | The pattern of mailbox names to match, optionally including either or both
of the '*' and '%' wildcards. '*' will match zero or more characters and
cross hierarchical boundaries. '%' will also match zero or more characters,
but is limited to a single hierarchical level. (type: str ) | |
Returns | A deferred whose callback is invoked with a list of tuple s,
the first element of which is a tuple
of mailbox flags, the second element of which is the hierarchy delimiter
for this mailbox, and the third of which is the mailbox name; if the
command is unsuccessful, the deferred's errback is invoked instead. (type: Deferred ) |
List a subset of the subscribed available mailboxes
This command is allowed in the Authenticated and Selected states.
The parameters and returned object are the same as for the list
method, with one slight difference: Only mailboxes which have been
subscribed can be included in the resulting list.
Retrieve the status of the given mailbox
This command is allowed in the Authenticated and Selected states.
Parameters | mailbox | The name of the mailbox to query (type: str ) |
*names | The status names to query. These may be any number of:
'MESSAGES' , 'RECENT' , 'UIDNEXT' ,
'UIDVALIDITY' , and 'UNSEEN' . (type: str ) | |
Returns | A deferred which fires with the status information if the command is
successful and whose errback is invoked otherwise. The status information
is in the form of a dict . Each element of names
is a key in the dictionary. The value for each key is the corresponding
response from the server. (type: Deferred ) |
Add the given message to the given mailbox.
This command is allowed in the Authenticated and Selected states.
Parameters | mailbox | The mailbox to which to add this message. (type: str ) |
message | The message to add, in RFC822 format. Newlines in this file should be \r\n-style. (type: Any file-like object) | |
flags | The flags to associated with this message. (type: Any iterable of str ) | |
date | The date to associate with this message. This should be of the format
DD-MM-YYYY HH:MM:SS +/-HHMM. For example, in Eastern Standard Time, on
July 1st 2004 at half past 1 PM, "01-07-2004 13:30:00 -0500". (type: str ) | |
Returns | A deferred whose callback is invoked when this command succeeds or whose
errback is invoked if it fails. (type: Deferred ) |
Tell the server to perform a checkpoint
This command is allowed in the Selected state.
Returns | A deferred whose callback is invoked when this command succeeds or whose
errback is invoked if it fails. (type: Deferred ) |
Return the connection to the Authenticated state.
This command is allowed in the Selected state.
Issuing this command will also remove all messages flagged \Deleted from the selected mailbox if it is opened in read-write mode, otherwise it indicates success by no messages are removed.
Returns | A deferred whose callback is invoked when the command completes
successfully or whose errback is invoked if it fails. (type: Deferred ) |
Return the connection to the Authenticate state.
This command is allowed in the Selected state.
Issuing this command will perform the same actions as issuing the close command, but will also generate an 'expunge' response for every message deleted.
Returns | A deferred whose callback is invoked with a list of the 'expunge' responses
when this command is successful or whose errback is invoked otherwise. (type: Deferred ) |
Search messages in the currently selected mailbox
This command is allowed in the Selected state.
Any non-zero number of queries are accepted by this method, as returned
by the Query
, Or
, and Not
functions.
One keyword argument is accepted: if uid is passed in with a non-zero value, the server is asked to return message UIDs instead of message sequence numbers.
Returns | A deferred whose callback will be invoked with a list of all the message
sequence numbers return by the search, or whose errback will be invoked if
there is an error. (type: Deferred ) |
Retrieve the unique identifier for one or more messages
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message sequence
numbers to unique message identifiers, or whose errback is invoked if there
is an error. (type: Deferred ) |
Retrieve the flags for one or more messages
This command is allowed in the Selected state.
Parameters | messages | The messages for which to retrieve flags. (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
lists of flags, or whose errback is invoked if there is an error. (type: Deferred ) |
Retrieve the internal date associated with one or more messages
This command is allowed in the Selected state.
Parameters | messages | The messages for which to retrieve the internal date. (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
date strings, or whose errback is invoked if there is an error. Date
strings take the format of "day-month-year time timezone". (type: Deferred ) |
Retrieve the envelope data for one or more messages
This command is allowed in the Selected state.
Parameters | messages | The messages for which to retrieve envelope data. (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
envelope data, or whose errback is invoked if there is an error. Envelope
data consists of a sequence of the date, subject, from, sender, reply-to,
to, cc, bcc, in-reply-to, and message-id header fields. The date, subject,
in-reply-to, and message-id fields are strings, while the from, sender,
reply-to, to, cc, and bcc fields contain address data. Address data
consists of a sequence of name, source route, mailbox name, and hostname.
Fields which are not present for a particular address may be None . (type: Deferred ) |
Retrieve the structure of the body of one or more messages
This command is allowed in the Selected state.
Parameters | messages | The messages for which to retrieve body structure data. (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
body structure data, or whose errback is invoked if there is an error.
Body structure data describes the MIME-IMB format of a message and consists
of a sequence of mime type, mime subtype, parameters, content id,
description, encoding, and size. The fields following the size field are
variable: if the mime type/subtype is message/rfc822, the contained
message's envelope information, body structure data, and number of lines of
text; if the mime type is text, the number of lines of text. Extension
fields may also be included; if present, they are: the MD5 hash of the
body, body disposition, body language. (type: Deferred ) |
Retrieve the simplified body structure of one or more messages
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
body data, or whose errback is invoked if there is an error. The
simplified body structure is the same as the body structure, except that
extension fields will never be present. (type: Deferred ) |
Retrieve one or more entire messages
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or
str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A Deferred
which will fire with a dict mapping message sequence numbers
to dict s giving message data for the corresponding message.
If uid is true, the inner dictionaries have a
'UID' key mapped to a str
giving the UID for the message. The text of the message is a str
associated with the 'RFC822' key in each dictionary. (type: Deferred ) |
Retrieve headers of one or more messages
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
dicts of message headers, or whose errback is invoked if there is an error. (type: Deferred ) |
Retrieve body text of one or more messages
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
file-like objects containing body text, or whose errback is invoked if
there is an error. (type: Deferred ) |
Retrieve the size, in octets, of one or more messages
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
sizes, or whose errback is invoked if there is an error. (type: Deferred ) |
Retrieve several different fields of one or more messages
This command is allowed in the Selected state. This is equivalent to
issuing all of the fetchFlags
, fetchInternalDate
,
fetchSize
, fetchEnvelope
, and
fetchSimplifiedBody
functions.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
dict of the retrieved data values, or whose errback is invoked if there is
an error. They dictionary keys are "flags", "date",
"size", "envelope", and "body". (type: Deferred ) |
Retrieve several different fields of one or more messages
This command is allowed in the Selected state. This is equivalent to
issuing all of the fetchFlags
, fetchInternalDate
,
fetchSize
, and fetchEnvelope
functions.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
dict of the retrieved data values, or whose errback is invoked if there is
an error. They dictionary keys are "flags", "date",
"size", and "envelope". (type: Deferred ) |
Retrieve several different fields of one or more messages
This command is allowed in the Selected state. This is equivalent to
issuing all of the fetchFlags
, fetchInternalDate
,
and fetchSize
functions.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a dict mapping message numbers to
dict of the retrieved data values, or whose errback is invoked if there is
an error. They dictionary keys are "flags", "date",
and "size". (type: Deferred ) |
Given the result of parsing a single FETCH response, construct a
dict
mapping response keys to response values.
Parameters | fetchResponseList | The result of parsing a FETCH response with parseNestedParens
and extracting just the response data (that is, just the part that comes
after "FETCH" ). The form of this input (and
therefore the output of this method) is very disagreeable. A valuable
improvement would be to enumerate the possible keys (representing them as
structured objects of some sort) rather than using strings and tuples of
tuples of strings and so forth. This would allow the keys to be documented
more easily and would allow for a much simpler application-facing API (one
not based on looking up somewhat hard to predict keys in a dict). Since
fetchResponseList notionally represents a flattened sequence
of pairs (identifying keys followed by their associated values), collapsing
such complex elements of this list as ["BODY",
["HEADER.FIELDS", ["SUBJECT"]]] into a single
object would also greatly simplify the implementation of this method. |
Returns | A dict of the response data represented by pairs .
Keys in this dictionary are things like
"RFC822.TEXT" , "FLAGS" , or
("BODY", ("HEADER.FIELDS",
("SUBJECT",))) . Values are entirely dependent on the key
with which they are associated, but retain the same structured as produced
by parseNestedParens . |
Retrieve a specific section of one or more messages
Parameters | messages | A message sequence set (type: MessageSet or str ) |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
headerType | If specified, must be one of HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT,
MIME, or TEXT, and will determine which part of the message is retrieved.
For HEADER.FIELDS and HEADER.FIELDS.NOT, headerArgs must be a
sequence of header names. For MIME, headerNumber must be
specified. (type: str ) | |
headerNumber | The nested rfc822 index specifying the entity to retrieve. For example,
1 retrieves the first entity of the message, and (2, 1,
3 ) retrieves the 3rd entity inside the first entity inside the
second entity of the message. (type: int
or int
sequence) | |
headerArgs | If headerType is HEADER.FIELDS, these are the headers to
retrieve. If it is HEADER.FIELDS.NOT, these are the headers to exclude
from retrieval. (type: A sequence of str ) | |
peek | If true, cause the server to not set the \Seen flag on this message as a
result of this command. (type: bool ) | |
offset | The number of octets at the beginning of the result to skip. (type: int ) | |
length | The number of octets to retrieve. (type: int ) | |
Returns | A deferred whose callback is invoked with a mapping of message numbers to
retrieved data, or whose errback is invoked if there is an error. (type: Deferred ) |
Set the flags for one or more messages.
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
flags | The flags to set (type: Any iterable of str ) | |
silent | If true, cause the server to suppress its verbose response. (type: bool ) | |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a list of the server's responses
([] if silent is true) or whose errback is
invoked if there is an error. (type: Deferred ) |
Add to the set flags for one or more messages.
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
flags | The flags to set (type: Any iterable of str ) | |
silent | If true, cause the server to suppress its verbose response. (type: bool ) | |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a list of the server's responses
([] if silent is true) or whose errback is
invoked if there is an error. (type: Deferred ) |
Remove from the set flags for one or more messages.
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: MessageSet or str ) |
flags | The flags to set (type: Any iterable of str ) | |
silent | If true, cause the server to suppress its verbose response. (type: bool ) | |
uid | Indicates whether the message sequence set is of message numbers or of
unique message IDs. (type: bool ) | |
Returns | A deferred whose callback is invoked with a list of the server's responses
([] if silent is true) or whose errback is
invoked if there is an error. (type: Deferred ) |
Copy the specified messages to the specified mailbox.
This command is allowed in the Selected state.
Parameters | messages | A message sequence set (type: str ) |
mailbox | The mailbox to which to copy the messages (type: str ) | |
uid | If true, the messages refers to message UIDs, rather than
message sequence numbers. (type: bool ) | |
Returns | A deferred whose callback is invoked with a true value when the copy is
successful, or whose errback is invoked if there is an error. (type: Deferred ) |