15.1Class IMAP
IMAP class.
Class IMAP( server, [port],[timeout] )
server | Server address. |
port | Port number (default 143). |
timeout | Socket timeout in milliseconds (default 1000). |
Properties
Port number.
Current selected mailbox.
Server address.
Current state (see IMAPState).
Timeout (in milliseconds) waiting for server contact.
Function used to show communication between client and server.
Methods
Close selected mailbox.
close()
Connect to IMAP server.
connect()
Create a mailbox.
create( mailbox )
mailbox | The mailbox to create. |
Raise |
|
Delete a mailbox.
delete( mailbox )
mailbox | The mailbox to delete. |
Raise |
|
Expunge a mailbox.
expunge()
Fetch data associated with a message.
fetch( msg_set, [msg_parts] )
msg_set | Message id or a sequence of message ids. |
msg_parts | message data item names or macro (default FAST). |
Return | the raw data. |
Raise |
|
That is a raw, 'low-level' function returning the untreated answer got from the server. More appropriate functions are the IMAP.get* functions.
See also: http.
Get a whole message.
getBody( msg_id )
msg_id | The message id. |
Return | The whole message. |
Raise |
|
Get a section of a message.
getBodySection( msg_id, section )
msg_id | The message id. |
section | The desired section. |
Raise |
|
Examples:
imap.getBodySection( 1, 'HEADER' ) # get header
imap.getBodySection( 3, '1.HEADER' ) # get header of first part
imap.getBodySection( 5, 3 ) # get third part...
Get the flags associated with a message.
getFlags( msg_id )
msg_id | The message id. |
Return | A list of flags. |
Raise |
|
Get the hierarchy delimiter.
getHierarchyDelimiter( [ref] )
ref | The reference (default ""). |
Return | The character used as hierarchy delimiter. |
Get the RFC822 size of a message.
getSize( msg_id )
msg_id | The message id. |
Return | The message size. |
Raise |
|
Login procedure.
login( user, pasw )
user | username. |
pasw | password. |
Raise |
|
Connection attempt will be performed if not already done.
Logout procedure.
logout()
List mailboxes.
lst( [dir],[pattern] )
dir | Reference directory (default ""). |
pattern | Search pattern (default ""). |
Return | A list of mailboxes information. |
Raise |
|
List subscribed mailboxes.
lsub( [dir],[pattern] )
dir | Reference directory (default ""). |
pattern | Search pattern (default ""). |
Return | A list of subscribed mailboxes names. |
Raise |
|
Rename a mailbox.
rename( oldbox, newbox )
oldbox | The actual mailbox to rename. |
newbox | The desired mailbox name. |
Raise |
|
Search for messages.
search( [criterion],[charset] )
criterion | Search criteria (default ALL). |
charset | Optional charset specification. |
Return | A list of message ids matching the criteria. |
Raise |
|
Select a mailbox.
sel( [mailbox],[readonly] )
mailbox | The mailbox to select (default INBOX). |
readonly | (boolean) Default false. |
Raise |
|
Subscribe to a mailbox.
subscribe( mailbox )
mailbox | The mailbox to subscribe to. |
Raise |
|
Unsubscribe to a mailbox.
unsubscribe( mailbox )
mailbox | The mailbox to unsubscribe to. |
Raise |
|