SYNOPSIS

\*(C`use Net::IMAP;\*(C'

DESCRIPTION

\*(C`Net::IMAP\*(C' provides a perl interface to the client portion of \s-1IMAP\s0 (Internet Message Access Protocol).

add more meat - describe overall design (commands, responses, callbacks, convenience routines

METHODS

Creates a new \*(C`Net::IMAP\*(C' object, connects to $host on port 143, performs some preliminary setup of the session, and returns a reference to the object.

Once connected, it processes the connection banner sent by the server. If the considers the session to be preauthenticated, \*(C`new\*(C' notes the fact, allowing commands to be issued without logging in.

The method also issues a \*(C`capability\*(C' command, and notes the result. If the server does support IMAP4rev1, the method closes the connection and returns \*(C`undef\*(C'.

The client will use non-synchronizing literals if the server supports the \*(C`LITERAL+\*(C' extension (\s-1RFC2088\s0) and the \*(C`NonSyncLits\*(C' options is set to 1.

The following \*(C`Net::xAP\*(C' options are relevant to \*(C`Net::IMAP\*(C':

\*(C`Net::IMAP\*(C' also understands the following options, specific to the module: Controls what style of end-of-line processing to presented to the end-programmer. The default, 'lf', assumes that the programemr wants to fling messages terminated with bare LFs when invoking append, and when fetching messages. In this case, the module will map to/from \s-1CRLF\s0 accordingly. If \*(C`EOL\*(C' is set to 'crlf', the assumption is that the programmer wants messages, or portions of messages, to be terminated with \s-1CRLF\s0. It also assumes the programmer is providing messages terminated with the string when invoking the \*(C`append\*(C' method, and will not provide an \s-1EOL\s0 mapping.

IMAP COMMAND METHODS

There are numerous commands in the \s-1IMAP\s0 protocol. Each of these are mapped to a corresponding method in the \*(C`Net::IMAP\*(C' module.

Some commands can only be issued in certain protocol states. Some commands alter the state of the session. These facts are indicated in the documentation for the individual command methods.

The following list enumerates the protocol states:

Non-authenticated

The client has not authenticated with the server. Most commands are unavailable in this state.

Authenticated

The client has authenticated with the server.

Selected

The client has opened a mailbox on the server.

\$1

Sends a \*(C`noop\*(C' command to the server. It is valid in any protocol state.

This method is useful for placating the auto-logout god, or for triggering pending unsolicited responses from the server. The \*(C`capability\*(C' method retrieves the capabilities the \s-1IMAP\s0 server supports. This method is valid in any protocol state.

The server sends a \*(C`capability\*(C' response back to the client.

If the response does not indicate support for the \*(C`LITERAL+\*(C' extension, the \*(C`NonSyncLits\*(C' option is forced off. Logs off of the server. This method is valid in any protocol state. Logs into the server using a simple plaintext password. This method is only valid when the protocol is in the non-authenticated state.

If the server supports \s-1RFC2221\s0 (\s-1IMAP4\s0 Login Referrals), the completion response could include a referral. See \s-1RFC2221\s0 for further information about login referrals.

If successful, the session state is changed to authenticated. Logs into the server using the authentication mechanism specified in $authtype. This method is only valid when the protocol is in the non-authenticated state.

The \s-1IMAP\s0 \*(C`authenticate\*(C' command is the same as that documented in \s-1RFC2222\s0 (Simple Authentication and Security Layer (\s-1SASL\s0)), despite the fact that \s-1IMAP\s0 predates \s-1SASL\s0.

If successful, the session state is changed to authenticated.

The following authentication mechanisms are currently supported: This is a variation on the simple login technique, except that the information is transmitted in Base64. This does not provide any additional security, but does allow clients to use \*(C`authenticate\*(C'. This implements the authentication mechanism defined in \s-1RFC2195\s0 (\s-1IMAP/POP\s0 AUTHorize Extension for Simple Challenge/Response). It uses keyed \s-1MD5\s0 to avoid sending the password over the wire. This implements the authentication mechanism defined in \s-1RFC2245\s0 (Anonymous \s-1SASL\s0 Mechanism). Anonymous \s-1IMAP\s0 access is intended to provide access to public mailboxes or newsgroups.

The method returns \*(C`undef\*(C' is $authtype specifies an unsupported mechanism or if the server does not advertise support for the mechanism. The \*(C`has_authtype\*(C' method can be used to see whether the server supports a particular authentication mechanism.

In general, if the server supports a mechanism supported by \*(C`Net::IMAP\*(C', the \*(C`authenticate\*(C' command should be used instead of the \*(C`login\*(C' method. Opens the specified mailbox with the intention of performing reading and writing. This method is valid only when the session is in the authenticated or selected states.

If successful, the server sends several responses: \*(C`flags\*(C', \*(C`exists\*(C', \*(C`resent\*(C', as well as \*(C`ok\*(C' responses containing a \*(C`unseen\*(C', \*(C`permanentflags\*(C', \*(C`uidnext\*(C', and \*(C`uidvalidity\*(C' codes. If also changes the session state to selected.

If server returns a \*(C`no\*(C' response containing a \*(C`newname\*(C' response code, this means $mailbox does not exist but the server thinks this is because the folder was renamed. In this case, try specifiying the new folder name provided with the \*(C`newname\*(C' response code. Opens the specified mailbox in read-only mode. This method is valid only when the session is in the authenticated or selected states. Creates the specified mailbox. This method is valid only when the session is in the authenticated or selected states.

The optional $partition argument is only valid with the Cyrus \s-1IMAP\s0 daemon. Refer to the section 'Specifying Partitions with \*(L"create\*(R"' the \*(C`doc/overview\*(C' file for that package for further information. This feature can only be used by administrators creating new mailboxes. Other servers will probably reject the command if this argument is used. The results are undefined if another server accepts a second argument. Deletes the specified mailbox. Returns \*(C`undef\*(C' if $mailbox is the currently open mailbox. This method is valid only when the session is in the authenticated or selected states. Renames the mailbox specified in $oldmailbox to the name specified in $newmailbox. This method is valid only when the session is in the authenticated or selected states.

The optional $partition argument is only valid with the Cyrus \s-1IMAP\s0 daemon. Refer to the section 'Specifying Partitions with \*(L"rename\*(R"' the \*(C`doc/overview\*(C' file for that package for further information. This feature can only be used by administrators. Other servers will probably reject the command if this argument is used. The results are undefined if another server accepts a third argument. Subscribe to the specified $mailbox. Subscribing in \s-1IMAP\s0 is subscribing in Usenet News, except that the server maintains the subscription list. This method is valid only when the session is in the authenticated or selected states. Unsubscribe from the specified $mailbox. This method is valid only when the session is in the authenticated or selected states. Send an \s-1IMAP\s0 \*(C`list\*(C' command to the server. This method is valid only when the session is in the authenticated or selected states.

Although \s-1IMAP\s0 folders do not need to be implemented as directories, think of an \s-1IMAP\s0 reference name as a parameter given to a \*(C`cd\*(C' or \*(C`chdir\*(C' command, prior to checking for folders matching $mailbox_pattern.

The $mailbox_pattern parameter allows a couple wildcard characters to list subsets of the mailboxes on the server.

*

Matches zero or more characters at the specified location.

%

Like \*(C`*\*(C', matches zero or more characters at the specified location, but does not match hierarchy delimiter characters. If the last character in $mailbox_pattern is a \*(C`%\*(C', matching levels of hierarchy are also returned. In other words: subfolders.

This method will fail, returning \*(C`undef\*(C', if $mailbox_pattern is \*(C`*\*(C'. This behavior is not built into the \s-1IMAP\s0 protocol; it is wired into \*(C`Net::IMAP\*(C'. Doing otherwise could be rude to both the client and server machines. If you want to know why, imagine doing \*(C`list('#news.', '*')\*(C' on a machine with a full news feed. The \*(C`%\*(C' character should be used to build up a folder tree incrementally.

If successful, the server sends a series of \*(C`list\*(C' responses.

Please note that the $referencename is an IMAPism, not a Perl reference. Also note that the wildcards usable in $mailbox_pattern are specific to \s-1IMAP\s0. Perl regexps are not usable here. Sends an \s-1IMAP\s0 \*(C`lsub\*(C' command to the server. The \*(C`lsub\*(C' command is similar to the \*(C`list\*(C' command, except that the server only returns subscribed mailboxes. This method is valid only when the session is in the authenticated or selected states.

The parameters are the same as those for the \*(C`list\*(C' method.

If successful, the server sends a series of \*(C`lsub\*(C' responses. Retrieves status information for the specified $mailbox. This method is valid only when the session is in the authenticated or selected states.

Per \s-1RFC2060\s0, the @statusattrs can contain any of the following strings:

* messages

The number of messages in the mailbox.

* recent

The number of messages with the \*(C`\recent\*(C' flag set.

* uidnext

The \s-1UID\s0 expected to be assigned to the next mailbox appended to the mailbox. This requires some explanation. Rather than using this value for prefetching the next \s-1UID\s0, it should be used to detect whether messages have been added to the mailbox. The value will not change until messages are appended to the mailbox.

* uidvalidity

The unique identifier validity value of the mailbox.

* unseen

The number of messages without the \*(C`\seen\*(C' flag set.

This method will fail, returning \*(C`undef\*(C' if $mailbox is the currently open mailbox.

If successful, the server sends one or more \*(C`status\*(C' responses.

The status operation can be rather expensive on some folder implementations, so clients should use this method sparingly. Appends the email message specified in $message to the mailbox specified in $mailbox. This method is valid only when the session is in the authenticated or selected states.

In general, the email message should be a real \s-1RFC822\s0 message, although exceptions such as draft messages are reasonable in some situations. Also note that the line terminators in $message need to be \s-1CRLF\s0.

The \*(C`Flags\*(C' option allows a set of flags to be specified for the message when it is appended. Servers are not required to honor this, but most, if not all, do so.

The \*(C`Date\*(C' option forces the internaldate to the specified value. If $date is a string, the format of the string is \*(C`dd-mmm-yyyy hh:mm:ss [-+]zzzz\*(C', where \*(C`dd\*(C' is the day of the month (starting from 1), \*(C`mmm\*(C' is the three-character abbreviation for the month name, \*(C`yyyy\*(C' is the 4-digit year, \*(C`hh\*(C' is the hour, \*(C`mm\*(C' is the minutes, \*(C`ss\*(C' is the seconds, and \*(C`[-+]zzzz\*(C' is the numeric timezone offset. This happens to be the same format returned by the \*(C`internaldate\*(C' item from the \*(C`fetch\*(C' command. If $date is a list reference, it is expected to contain two elements: a time integer and a timezone offset string. The timezone string is expected to be formatted as \*(C`[-+]zzzz\*(C'. These two values will be used to synthesize a string in the format expected by the \s-1IMAP\s0 server. As with the \*(C`Flags\*(C' options, servers are not required to honor the \*(C`Date\*(C' option, but most, if not all, do so.

Note that the options are specified at the end of the list of method arguments. This is due to the fact that it is possible to have a $mailbox named \*(C`Flags\*(C' or \*(C`Date\*(C'. Processing the options at the end of the argument list simplifies argument processing. The order of the arguments will be changed if enough people complain.

If server returns a \*(C`no\*(C' response containing a \*(C`trycreate\*(C' response code, this means $mailbox does not exist but the server thinks the command would have succeeded if the an appropriate \*(C`create\*(C' command was issued. On the other hand, failure with no \*(C`trycreate\*(C' response code generally means that a \*(C`create\*(C' should not be attempted. Ask the server to perform a checkpoint of its data. This method is valid only when the session is in the selected state.

While not always needed, this should be called if the client issues a large quantity of updates to a folder in an extended session. Close the current mailbox. This method is valid only when the session is in the selected state.

If successful, the session state is changed to authenticated. Delete messages marked for deletion. This method is valid only when the session is in the selected state.

If successful, the server sends a series of \*(C`expunge\*(C' responses.

It will return \*(C`undef\*(C' is the mailbox is marked read-only. Searches the mailbox for messages matching the criteria contained in @searchkeys. This method is valid only when the session is in the selected state.

The @searchkeys list contains strings matching the format described in Section 6.4.4 of \s-1RFC2060\s0.

If successful, the server send zero or more \*(C`search\*(C' responses. Lack of a \*(C`search\*(C' response means the server found no matches. Note that the server can send the results of one search in multiple responses. Retrieves data about a set of messages. This method is valid only when the session is in the selected state.

The $msgset parameter identifies the set of messages from which to retrieve the items of interest. The notation accepted is similar to that found in \*(C`.newsrc\*(C' files, except that \*(C`:\*(C' is used to specify ranges, instead of \*(C`-\*(C'. Thus, to specify messages 1, 2, 3, 5, 7, 8, 9, the following string could be used: '1:3,5,7:9'. The character \*(C`*\*(C' can be used to indicate the highest message number in the mailbox. Thus, to specify the last 4 messages in an 8-message mailbox, you can use '5-*'.

The following list enumerates the items that can be retrieved with \*(C`fetch\*(C'. Refer to Section 6.4.5 of \s-1RFC2060\s0 for a description of each of these items.

* body[$section]<$partial>
* body.peek[$section]<$partial>

Important: the response item returned for a \*(C`body.peek\*(C' is \*(C`body\*(C'.

* bodystructure
* body
* envelope
* flags
* internaldate
* rfc822
* rfc822.header
* rfc822.size
* rfc822.text
* uid

Please note that the items returning messages, or portion of messages, return strings terminated with \s-1CRLF\s0.

\s-1RFC2060\s0 also defines several items that are actually macros for other sets of items:

* all

A macro equivalent to \*(C`('flags', 'internaldate', 'rfc822.size', 'envelope')\*(C'.

* full

A macro equivalent to \*(C`('flags', 'rfc822.size', 'envelope', 'body')\*(C'.

* fast

A macro equivalent to \*(C`('flags', 'internaldate', 'rfc822.size')\*(C'.

The \*(C`all\*(C', \*(C`full\*(C', and \*(C`fast\*(C' items are not intended to be used with other items.

If successful, the server responses with one or more \*(C`fetch\*(C' responses.

If the completion response from a \*(C`fetch\*(C' command is \*(C`no\*(C', the client should send a \*(C`noop\*(C' command, to force any pending expunge responses from the server, and retry the \*(C`fetch\*(C' command with $msgset adjusted accordingly. Sets various attributes for the messages identified in $msgset. This method is valid only when the session is in the selected state.

The $msgset parameter is described in the section describing \*(C`fetch\*(C'.

The $itemname can be one of the following:

* flags

Replaces the current flags with the flags specified in @storeattrflags.

* +flags

Adds the flags specified in @storeattrflags to the current flags.

* -flags

Removes the flags specified in @storeattrflags from the current flags.

The $itemname can also have \*(C`.silent\*(C' appended, which causes the server to not send back update responses for the messages.

If successful, and \*(C`.silent\*(C' is used used in $itemname, the server response with a series of \*(C`fetch\*(C' responses reflecting the updates to the specified messages.

If the completion response from a \*(C`store\*(C' command is \*(C`no\*(C', the client should send a \*(C`noop\*(C' command, to force any pending expunge responses from the server, and retry the \*(C`store\*(C' command with $msgset adjusted accordingly.

The @storeattrflags is a list of flag strings. Copy the messages $msgset to the specified mailbox. This method is valid only when the session is in the selected state.

The $msgset parameter is described in the section describing \*(C`fetch\*(C'.

If server returns a \*(C`no\*(C' response containing a \*(C`trycreate\*(C' response code, this means $mailbox does not exist but the server thinks the command would have succeeded if the an appropriate \*(C`create\*(C' command was issued. On the other hand, failure with no \*(C`trycreate\*(C' response code generally means that a \*(C`create\*(C' should not be attempted. A variant of \*(C`copy\*(C' that uses UIDs in $msgset, instead of message numbers. This method is valid only when the session is in the selected state. A variant of \*(C`fetch\*(C' that uses UIDs, instead of message numbers, in $msgset and \*(C`fetch\*(C' responses. This method is valid only when the session is in the selected state. A variant of \*(C`search\*(C' that uses UIDs, instead of message numbers, in $msgset and \*(C`search\*(C' responses. This method is valid only when the session is in the selected state. A variant of \*(C`store\*(C' that uses UIDs, instead of message numbers, in $msgset and \*(C`fetch\*(C' responses. This method is valid only when the session is in the selected state.

CONVENIENCE ROUTINES

In addition to the core protocol methods, \*(C`Net::IMAP\*(C' provides several methods for accessing various pieces of information. Returns a boolean valud indicating whether the \s-1IMAP\s0 session is preauthenticated. Returns the banner string issued by the server at connect time. Returns the list of capabilities supported by the server, minus the authentication capabilities. The list is not guaranteed to be in any specific order. Returns a boolean value indicating whether the server supports the specified capability. Returns a list of authentication types supported by the server. Returns a boolean value indicating whether the server supports the specified authentication type. Returns the quantity of messages in the currently selected folder. Returns the quantity of recent messages in the currently selected folder. Returns the message number of the first unseen messages in the currently selected folder. Returns the \*(C`uidvalidity\*(C' value for the currently selected folder. This is useful for \s-1IMAP\s0 clients that cache data in persistent storage. Cache data for a mailbox should only be considered valid if the \*(C`uidvalidity\*(C' is the same for both cached data and the remote mailbox. See Section 2.3.1.1 of \s-1RFC2060\s0 for further details. Returns the \*(C`uidnext\*(C' value for the currently selected folder. Returns the list of permanent flags the server has identified for the currently open mailbox.

If a \*(C`\*\*(C' flag is present, the server allows new persistent keywords to be created. Returns a boolean value indicating whether the server considers $flag to be a permanent flag. Returns a list of the flags associated with the mailbox. Returns a boolean value indicating whether the given $flag is defined for the mailbox. Returns the name of the currently open mailbox. Returns \*(C`undef\*(C' if no mailbox is currently open. Returns a boolean value indicating whether the currently open mailbox is read-only.

NAMESPACE EXTENSION

The following methods are available if the server advertises support for \s-1RFC2342\s0 (\s-1IMAP4\s0 Namespace). Refer to that \s-1RFC\s0 for additional information. Sends a \*(C`namespace\*(C' command to the server, if the server advertises support for the extension extension.

ACCESS CONTROL EXTENSION

The following methods are available if the server advertises support for \s-1RFC2086\s0 (\s-1IMAP4\s0 \s-1ACL\s0 Extension). Refer to that \s-1RFC\s0 for additional information. Sets the access control list for $identifier on $mailbox according to the rights contained in $modrights.

The $identifier typically identifies an account name, but can also specify abstract entities, such as groups.

The format for $modrights is documented in \s-1RFC2086\s0. Retrieves the access control list for $mailbox. Deletes all access control list entries for $identifier from $mailbox. List the rights available to $identifier for $mailbox. List the rights the current user has for $mailbox.

QUOTA EXTENSION

The following methods are available if the server advertises support for \s-1RFC2087\s0 (\s-1IMAP4\s0 Quota Extension). Refer to that \s-1RFC\s0 for additional information. Lists the resource usage and limits for $quotaroot. Sets the resource limits for $quotaroot to @setquotalist.

Valid values for @setquotalist are server-dependant. Lists the quota roots for $mailbox.

UIDPLUS EXTENSION

The following method is available if the server advertises support for \s-1RFC2359\s0 (\s-1IMAP4\s0 \s-1UIDPLUS\s0 Extension). Refer to that \s-1RFC\s0 for additional information. A variant of \*(C`expunge\*(C' that allows the operation to be narrowed to the messages with UIDs specified in $msgset.

The $msgset parameter is described in the section describing \*(C`fetch\*(C'.

CALLBACKS

Many of the command methods result in the server sending back response data. \*(C`Net::IMAP\*(C' processes each response by parsing the data, packages it in an appropriate object, and optionally calls a programmer-defined callback for the response. This callback mechanism is how programmers get access to the data retrieved from the server. Assigns a programmer-defined code reference to the associated untagged response. When an untagged response matching $item is received, $coderef is called, with the \s-1IMAP\s0 object and the associated response object passed as parameters.

The default callback for the \*(C`ok\*(C', \*(C`bye\*(C', \*(C`bad\*(C', and \*(C`no\*(C' untagged responses includes code to output the text from \*(C`alert\*(C' responses to stderr, using \*(C`carp\*(C'. If you set your own callback for these responses, be sure to code handle \*(C`alert\*(C' codes. Per Section 7.1 of \s-1RFC2060\s0, clients are required to clearly display \*(C`alert\*(C' messages to users.

RESPONSE OBJECTS

As mention in the previous section, responses are parsed and packaged into response objects, which are then passed to callbacks. Each type of response has a corresponding object class. This section describes the various response objects provided.

All of the class names itemized below are prefixed with \*(C`Net::IMAP\*(C'.

As a general rule, \s-1IMAP\s0 \*(C`nil\*(C' items are set to \*(C`undef\*(C' in the parsed data, and \s-1IMAP\s0 parenthetical lists are converted to list references (of one form or another). In addition, atoms, quoted strings, and literals are presented as Perl strings.

The condition responses (\*(C`ok\*(C', \*(C`no\*(C', \*(C`bad\*(C', \*(C`bye\*(C', and \*(C`preauth\*(C') can include a response code. Refer to Section 7.1 in \s-1RFC2060\s0 for a description of each of the standard response codes.

Response

This is the object class for completion responses. Returns a boolean value indicating whether the response is tagged. In the case of tagged completion responses, this value is always 1. Returns a boolean value indicating whether the \*(C`TRYCREATE\*(C' response code is present in the response. This can be used after a failed \*(C`append\*(C' or \*(C`copy\*(C' command to determine whether the server thinks the operation would succeed if a \*(C`create\*(C' was issued for the associated mailbox.

UntaggedResponse

This class is common to all untagged server responses. Returns a string containing the tag associated with the response. In the case of untagged responses, this is always \*(C`*\*(C'. Returns a boolean value indicating whether the response is tagged. Obviously, in the case of untagged responses, this value is always 0. Returns a reference to the parent \s-1IMAP\s0 object.

Ok

This is a container for untagged \*(C`ok\*(C' responses from the server. Returns a list reference containing response code elements in the response. Returns \*(C`undef\*(C' if no response code is present. Returns the name of the response. In the case of \*(C`Ok\*(C', this returns 'ok'. This method is provided as a convenience for end-programmers wanting to write one common subroutine for one or more of the responses \*(C`Ok\*(C', \*(C`No\*(C', \*(C`Bad\*(C', and \*(C`Bye\*(C'.

No

This is a container for untagged \*(C`no\*(C' responses from the server.

Bad

This is a container for untagged \*(C`bad\*(C' responses from the server.

Bye

This is a container for untagged \*(C`bye\*(C' responses from the server.

Expunge

This is a container for \*(C`expunge\*(C' responses from the server.

The information returned by \*(C`qty_messages\*(C' is automatically updated when \*(C`expunge\*(C' responses are received. Returns the message number specified in the \*(C`expunge\*(C' response.

Capability

This is a container for \*(C`capability\*(C' responses. Returns the list of capabilities supported by the server, minus the authentication capabilities. The list is not guaranteed to be in any specific order. Returns a boolean value indicating whether the server supports the specified capability. Returns a list of authentication types supported by the server. Returns a boolean value indicating whether the server supports the specified authentication type.

List

This is a container for \*(C`list\*(C' responses. Returns the name of the mailbox contained in the object. Returns the hierarchy delimiter associated with the mailbox. Returns a list of the flags associated with the mailbox. Returns a boolean value indicating whether the given $flag is defined for the mailbox.

List

This is a container for \*(C`lsub\*(C' responses. It provides the same interface as the \*(C`Net::IMAP::List\*(C' class.

Fetch

This is a container for \*(C`fetch\*(C' responses.

Responses for partial fetches bear special mention. While both the starting byte and quantity of bytes are specified when doing partial fetches with the \*(C`fetch\*(C' command, the corresponding response will only show the starting byte. In other words, the command \*(C`$imap->fetch(1, 'body[]<0.1024>'\*(C' will, if successful, result in a fetch response item of \*(C`body[]<0>\*(C' containing a 1024 octet value. To match a given response for a partial fetch, you might need to use \*(C`length\*(C' to match it up with the corresponding item specified in the \*(C`fetch\*(C' command. Returns the message number identified in the response. Returns the list of data item names contained in the response. The list is not guaranteed to be in any specific order. Returns the data associated with the specified data item.

The following list enumerates the data types associated with each fetch item:

envelope

Net::IMAP::Envelope

bodystructure

Net::IMAP::BodyStructure

body

Net::IMAP::BodyStructure

flags

Net::IMAP::Flags

\s-1UID\s0

Integer

rfc822.size

Integer

default

String

Status

This is a container for \*(C`status\*(C' responses. Returns a string containing the mailbox the status information is associated with. Returns the list of status items contains in the status response. Returns the value of the $item status item.

Search

This is a container for \*(C`search\*(C' responses. Returns the list of message numbers contained in the response.

Flags

This is a container for \*(C`flags\*(C' responses. Returns the list of flags contained in the response. Returns a boolean value indicating whether the specified flag is contained in the response.

As a convenience, the information from the \*(C`flags\*(C' response is also stored in the parent \*(C`Net::IMAP\*(C' object, and is available via \*(C`Net::IMAP\*(C' versions of the \*(C`flags\*(C' and \*(C`has_flags\*(C' methods.

Exists

This is a container for \*(C`exists\*(C' responses. Returns the quantity of messages in the currently selected mailbox.

This is information is also available in the \*(C`qty_messages\*(C' method in the \*(C`Net::IMAP\*(C' class.

Recent

This is a container for \*(C`recent\*(C' responses. Returns the number of messages with the \*(C`\recent\*(C' flag set.

This information is also available in the \*(C`qty_recent\*(C' method in the \*(C`Net::IMAP\*(C' class.

Namespace

This is a container for \*(C`namespace\*(C' responses. With no argument specified, returns a list of personal namespaces. If $namespace is specified, returns the delimiter character for the specific personal namespace. With no argument specified, returns a list of other users' namespaces. If $namespace is specified, returns the delimiter character for the specific other users' namespace. With no argument specified, returns a list of shared namespaces. If $namespace is specified, returns the delimiter character for the specific shared namespace.

ACL

This is a container for \*(C`acl\*(C' responses> Returns the name of the mailbox associated with the given \s-1ACL\s0 data. Returns a list of identifiers contained in the \s-1ACL\s0 data.

Listrights

This is a container for \*(C`listrights\*(C' responses. Returns the name of the mailbox associated with the given rights. Returns a string containing the identifier associated with the rights. Returns a string containing the rights contained in the response.

Myrights

This is a container for \*(C`myrights\*(C' responses Returns the name of the mailbox associated with the given rights. Returns a string containing the rights contained in the response.

Quota

This is a container for \*(C`quota\*(C' responses. Returns a string containing the name of the quota root in the response. Returns a list of the quotas contained in the response. Returns the usage value associated with the given $quota. Returns \*(C`undef\*(C' is the given $quota is not present in the response. Returns the usage limit associated with the given $quota. Returns \*(C`undef\*(C' is the given $quota is not present in the response.

Quotaroot

This is a container for \*(C`quotaroot\*(C' responses. Returns the name of the mailbox associated with the quotaroot data. If called in an array context, returns the list of quotaroots associated with the mailbox. If called in a scalar context, returns a list reference.

MISC FETCH OBJECTS

A \*(C`fetch\*(C' response can be relatively complicated. This section documents various classes and methods associated with the various pieces of information available in \*(C`fetch\*(C' responses.

BodyStructure

This is a container for \*(C`bodystructure\*(C' items in \*(C`fetch\*(C' responses. Returns a string containing the \s-1MIME\s0 type of the message. This is the left-hand portion of a \s-1MIME\s0 media type. For example, the type of \*(C`text/plain\*(C' is \*(C`text\*(C'. Returns a string containing the \s-1MIME\s0 subtype of the message. This is the right-hand portion of a \s-1MIME\s0 media type. For example, the subtype of \*(C`text/plain\*(C' is \*(C`plain\*(C'. Returns a reference to a hash containing the key/value attribute pairs in the \*(C`Content-Type\*(C' field.

If, for example, the \*(C`Content-Type\*(C' field was:

  Content-Type: text/plain; charset=us-ascii

The hash would contain one entry the a key of \*(C`charset\*(C', and a value of \*(C`us-ascii\*(C'. The key is always forced to be lowercase, but the case of the value is retained from the server. Returns the disposition type in the \*(C`Content-Disposition\*(C' field. Returns \*(C`undef\*(C' if no such field exists. Returns a reference to a hash containing the key/value attributer pairs in the \*(C`Content-Disposition\*(C' field. A reference to an empty hash is returned if no such field exists, or if there are no parameters in the field. Returns a reference to a list of the language tags present in the \*(C`Content-Language\*(C' field. Returns a reference to an empty hash if no such field is present.

Multipart

This is a container for \*(C`BodyStructure\*(C' objects that are multipart entities. Returns a list reference of the body parts contained in the multipart entity.

Bodypart

This is a container for singlepart entities in \*(C`BodyStructure\*(C' and \*(C`Multipart\*(C' objects. Return a string containing the contents of the \*(C`Content-ID\*(C' field, if one is present, otherwise returns undef. Return a string containing the contents of the \*(C`Content-Description\*(C' field, if one is present, otherwise returns undef. Returns a string containing the contents of the \*(C`Content-Transfer-Encoding\*(C' field. Returns \*(C`undef\*(C' if no such field is in the entity. Returns the number of octets in the entity. If the \s-1MIME\s0 content type is \*(C`message/rfc822\*(C' or the major type is \*(C`text\*(C', returns the number of lines in the entity, else returns \*(C`undef\*(C'. If the \s-1MIME\s0 content type is \*(C`message/rfc822\*(C', returns a \*(C`Net::IMAP::Envelope\*(C' object, otherwise returns undef. If the \s-1MIME\s0 content type is \*(C`message/rfc822\*(C', returns a \*(C`Net::IMAP::BodyStructure\*(C' object, otherwise returns undef. Returns a string containing the contents of the \*(C`Content-MD5\*(C' field. Returns \*(C`undef\*(C' if no such field is in the entity.

Envelope

This is a container for envelope data in \*(C`fetch\*(C' responses.

For those familiar with \s-1SMTP\s0, this is not the same type envelope. Rather, it is a composite structure containing key source, destination, and reference information in the message. When retrieved from the server, it is populated into a \*(C`Net::IMAP::Envelope\*(C' object. The following methods are available. Returns a string with the contents of the \*(C`Date\*(C' field. Returns a string with the contents of the \*(C`Subject\*(C' field. Returns a list reference of \*(C`Net::IMAP::Addr\*(C' objects with the contents of the \*(C`From\*(C' field. Returns a list reference of \*(C`Net::IMAP::Addr\*(C' objects with the contents of the \*(C`Sender\*(C' field. If no \*(C`Sender\*(C' field is present in the message, the server will default it to the contents of the \*(C`From\*(C' field. Returns a list reference of \*(C`Net::IMAP::Addr\*(C' objects with the contents of the \*(C`Reply-To\*(C' field. If no \*(C`Reply-To\*(C' field is present in the message, the server will default it to the contents of the \*(C`From\*(C' field. Returns a list reference of \*(C`Net::IMAP::Addr\*(C' objects with the contents of the \*(C`To\*(C'field. Will return \*(C`undef\*(C' if no \*(C`To\*(C' field exists in the message. Returns a list reference of \*(C`Net::IMAP::Addr\*(C' objects with the contents of the \*(C`Cc\*(C' field. Will return \*(C`undef\*(C' if no \*(C`Cc\*(C' field exists in the message. Returns a list reference of \*(C`Net::IMAP::Addr\*(C' objects with the contents of the \*(C`Bcc\*(C' field. Will return \*(C`undef\*(C' if no \*(C`Bcc\*(C' field exists in the message. Returns a string with the contents of the \*(C`In-Reply-To\*(C' field. Returns \*(C`undef\*(C' if no such field is present in the message. Returns a string with the contents of the \*(C`Date\*(C' field. Returns \*(C`undef\*(C' if no such field is present in the message.

Addr

This is a container for address structures in \*(C`Envelope\*(C' objects. Returns a string containing the phrase portion of the address, or \*(C`undef\*(C' if no phrase is present. Returns a string containing the route portion of the address, or \*(C`undef\*(C' if no route information is present. Returns a string containing the localpart portion of the address, or \*(C`undef\*(C' if no localpart is present. Returns a string containing the domain portion of the address, or \*(C`undef\*(C' if no domain is present. Returns a string representation of the contents of the object.

CAVEATS

Minimal testing has been done against the various \s-1IMAP\s0 server implementations. Refer to \*(C`BUGS\*(C' for known bugs/malfeatures.

AUTHOR

Kevin Johnson <[email protected]>

COPYRIGHT

Copyright (c) 1997-1999 Kevin Johnson <[email protected]>.

All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.