IP*Works!

ipworks
Class Imap

java.lang.Object
  |
  +--ipworks.Imap

public class Imap
extends java.lang.Object

The IMAP class is used to communicate with IMAP servers using the IMAP (Internet Message Access) protocol.

The IMAP class implements a standard IMAP client as specified in RFC 1730 and RFC 2060.

The first step in using the control is specifying a MailServer , a User to connect as, and a Password to authenticate with. After that, one or more requests may be sent to the server via the Action property. Results are retrieved through events and a number of key properties.

Normally, after connecting to the server, a Mailbox is selected (or examined) using the corresponding Action code. After the Mailbox is selected, MessageCount and RecentMessageCount show the number of messages in the mailbox, and MailboxFlags show the flags pertaining to the mailbox.

A number of operations may be performed by the server in response to commands sent via the Action property. The main arguments for most commands is the Mailbox property or the MessageSet property. The MessageSet property denotes either a single message, or a range of messages. Other arguments are specified through other properties such as SearchCriteria , MessageFlags , etc.

Responses are received through events such as MessageInfo , MailboxList , and also reflected to properties such as MessageText , MessageSubject , etc.

The MessagePart event describes the MIME structure of retrieved messages. One MessagePart event is fired for every message part, giving information about the particular part. Later on, message parts may be retrieved separately through the appropriate Action . This speeds up processing, by avoiding the need to retrieve full messages from the server.

The PITrail event traces the interaction between the client and the server. It includes all exchanges except for transfers of messages, message parts, and message headers.


Field Summary
static int a_AppendToMailbox
           
static int a_CheckMailbox
           
static int a_CloseMailbox
           
static int a_Connect
           
static int a_CopyToMailbox
           
static int a_CreateMailbox
           
static int a_DeleteMailbox
           
static int a_Disconnect
           
static int a_ExamineMailbox
           
static int a_ExpungeMailbox
           
static int a_GetMessageHeaders
           
static int a_GetMessageInfo
           
static int a_GetMessagePart
           
static int a_GetMessageText
           
static int a_Idle
           
static int a_ListMailboxes
           
static int a_ListSubscribedMailboxes
           
static int a_Noop
           
static int a_RenameMailbox
           
static int a_ResetMessageFlags
           
static int a_SearchMailbox
           
static int a_SelectMailbox
           
static int a_SetMessageFlags
           
static int a_SubscribeMailbox
           
static int a_UnsetMessageFlags
           
static int a_UnsubscribeMailbox
           
 
Constructor Summary
Imap()
           
 
Method Summary
 void addImapEventListener(ImapEventListener l)
           
 void fireEndTransfer()
          Fired when the message or the part data finishes transferring.
 void fireError(int errorCode, java.lang.String description)
          Information about errors during data delivery.
 void fireMailboxList(java.lang.String mailbox, java.lang.String separator, java.lang.String flags)
          Fired for each mailbox received through the various 'List Mailbox' actions.
 void fireMessageInfo(java.lang.String messageId, java.lang.String subject, java.lang.String date, java.lang.String from, int size)
          Fired with information for the message(s) retrieved by the server.
 void fireMessagePart(java.lang.String partId, int size, java.lang.String contentType, java.lang.String filename, java.lang.String contentEncoding, java.lang.String parameters, java.lang.String multipartMode)
          Fired for each message part when a 'Get Message Info' action is performed.
 void firePITrail(int direction, java.lang.String message)
          Traces the commands sent to the mail server, and the respective replies.
 void fireStartTransfer()
          Fired when the message or the part data starts transferring.
 void fireTransfer(int bytesTransferred, java.lang.String text)
          Fired while the message gets transferred from the MailServer .
 int getAction()
          An action code for the component.
 java.lang.String getLastReply()
          The last reply from the server.
 java.lang.String getLocalFile()
          The path to a local file for downloading the message body.
 java.lang.String getLocalHost()
          The name of the local host.
 java.lang.String getMailbox()
          Name of the mailbox selected on the server.
 java.lang.String getMailboxFlags()
          Defined flags in the selected mailbox.
 int getMailPort()
          The port of the IMAP server (default 143).
 java.lang.String getMailServer()
          The name or address of the mail server (IMAP server).
 java.lang.String getMessageBCc(int addressIndex)
          Array property with the list of BCc recipients of the message.
 java.lang.String getMessageCc(int addressIndex)
          Array property with the list of Cc recipients of the message.
 java.lang.String getMessageContentEncoding()
          The ContentEncoding of the selected message.
 java.lang.String getMessageContentType()
          The ContentType of the message.
 int getMessageCount()
          The total number of messages on the Mailbox .
 java.lang.String getMessageDate()
          The time the message was created.
 java.lang.String getMessageDeliveryTime()
          The time the message was delivered to the mail server.
 java.lang.String getMessageFlags()
          Flags of the current message.
 java.lang.String getMessageFrom()
          The address of the author of the message.
 java.lang.String getMessageHeaders()
          RFC822-encoded headers of the message.
 java.lang.String getMessageId()
          The message id of the current message.
 java.lang.String getMessageInReplyTo()
          The unique message ID of the message this one is in reply to.
 java.lang.String getMessageNetId()
          The globally unique id of the message.
 java.lang.String getMessageReplyTo()
          Email address(s) where replies to the message should be sent.
 java.lang.String getMessageSender()
          The address of the sender of the message.
 java.lang.String getMessageSet()
          The set of messages to operate on.
 int getMessageSize()
          The size of the selected message.
 java.lang.String getMessageSubject()
          The subject of the message.
 java.lang.String getMessageText()
          The body of the retrieved message The class fills out MessageText with the contents of the message body (in RFC822 format) when a 'Get Message Text' operation is triggered via the Action property.
 java.lang.String getMessageTo(int addressIndex)
          Array property with the list of direct recipients of the message.
 java.lang.String getNewMailbox()
          The new name of the mailbox during a 'Rename Mailbox' operation.
 java.lang.String getPartId()
          The PartId of the part to retrieve.
 java.lang.String getPassword()
          The password used to authenticate to the MailServer .
 int getRecentMessageCount()
          Number of new messages on the Mailbox .
 java.lang.String getSearchCriteria()
          Search criteria to use for search operations.
 java.lang.String getUser()
          The user name used to authenticate to the MailServer .
 boolean isUIDMode()
          If true, permanent message id-s are used instead of the default temporary id-s.
 void removeImapEventListener(ImapEventListener l)
           
 void setAction(int action)
          An action code for the component.
 void setCommand(java.lang.String command)
          Can be used to send additional commands directly to the IMAP server.
 void setLocalFile(java.lang.String localFile)
          The path to a local file for downloading the message body.
 void setMailbox(java.lang.String mailbox)
          Name of the mailbox selected on the server.
 void setMailPort(int mailPort)
          The port of the IMAP server (default 143).
 void setMailServer(java.lang.String mailServer)
          The name or address of the mail server (IMAP server).
 void setMessageFlags(java.lang.String messageFlags)
          Flags of the current message.
 void setMessageHeaders(java.lang.String messageHeaders)
          RFC822-encoded headers of the message.
 void setMessageSet(java.lang.String messageSet)
          The set of messages to operate on.
 void setMessageText(java.lang.String messageText)
          The body of the retrieved message The class fills out MessageText with the contents of the message body (in RFC822 format) when a 'Get Message Text' operation is triggered via the Action property.
 void setNewMailbox(java.lang.String newMailbox)
          The new name of the mailbox during a 'Rename Mailbox' operation.
 void setPartId(java.lang.String partId)
          The PartId of the part to retrieve.
 void setPassword(java.lang.String password)
          The password used to authenticate to the MailServer .
 void setSearchCriteria(java.lang.String searchCriteria)
          Search criteria to use for search operations.
 void setUIDMode(boolean UIDMode)
          If true, permanent message id-s are used instead of the default temporary id-s.
 void setUser(java.lang.String user)
          The user name used to authenticate to the MailServer .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a_Idle

public static final int a_Idle

a_Noop

public static final int a_Noop

a_Connect

public static final int a_Connect

a_Disconnect

public static final int a_Disconnect

a_SelectMailbox

public static final int a_SelectMailbox

a_ExamineMailbox

public static final int a_ExamineMailbox

a_CreateMailbox

public static final int a_CreateMailbox

a_DeleteMailbox

public static final int a_DeleteMailbox

a_RenameMailbox

public static final int a_RenameMailbox

a_SearchMailbox

public static final int a_SearchMailbox

a_AppendToMailbox

public static final int a_AppendToMailbox

a_CopyToMailbox

public static final int a_CopyToMailbox

a_CheckMailbox

public static final int a_CheckMailbox

a_ExpungeMailbox

public static final int a_ExpungeMailbox

a_CloseMailbox

public static final int a_CloseMailbox

a_ListMailboxes

public static final int a_ListMailboxes

a_ListSubscribedMailboxes

public static final int a_ListSubscribedMailboxes

a_SubscribeMailbox

public static final int a_SubscribeMailbox

a_UnsubscribeMailbox

public static final int a_UnsubscribeMailbox

a_GetMessageInfo

public static final int a_GetMessageInfo

a_GetMessageHeaders

public static final int a_GetMessageHeaders

a_GetMessageText

public static final int a_GetMessageText

a_GetMessagePart

public static final int a_GetMessagePart

a_ResetMessageFlags

public static final int a_ResetMessageFlags

a_SetMessageFlags

public static final int a_SetMessageFlags

a_UnsetMessageFlags

public static final int a_UnsetMessageFlags
Constructor Detail

Imap

public Imap()
Method Detail

getAction

public int getAction()
An action code for the component. Setting the Action property to a valid action code makes the class perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

Each action sends a command to the server, and waits until a reply is received. If there is no connection to the server, a connection is established automatically using the 'Connect' action below.

The following are the possible values for the Action property and the corresponding descriptions:

a_Idle
Default action. It can also be used to interrupt the current operation.
a_Noop
Sends an IMAP 'NOOP' command to the server. This is useful when the connection needs to be kept alive for long periods of time. (Normally, servers break the connection automatically after 30 minutes of inactivity).
a_Connect
Connect to the IMAP server specified by MailServer and authenticate using the user name and password supplied in the User and Password properties.
a_Disconnect
Logout and disconnect from the IMAP server.
a_SelectMailbox
Ask the server to select the mailbox specified in the Mailbox property. The mailbox is selected in read/write mode (if the server permits).
a_ExamineMailbox
Ask the server to select the mailbox specified in the Mailbox property in read-only mode.
a_CreateMailbox
Create a new mailbox. The mailbox name is specified by the Mailbox property.
a_DeleteMailbox
Delete a mailbox. The mailbox name is specified by the Mailbox property.
a_RenameMailbox
Rename a mailbox. The mailbox is specified by the Mailbox property, and the new name is specified by the NewMailbox property.
a_SearchMailbox
Search the selected mailbox using the criteria specified in the SearchCriteria property. For every message matching the criteria, the equivalent of a 'Get Message Info' action is performed and a MessageInfo event is fired. For more information about the format of the search criteria, please refer to the SearchCriteria property.
a_AppendToMailbox
Appends the RFC822-encoded message in MessageText to the mailbox specified by Mailbox . If the MessageFlags property is not an empty string, it's contents are supplied with the 'APPEND' command sent to the server.
a_CopyToMailbox
Copies the messages specified by the MessageSet property to the mailbox specified by the Mailbox property.
a_CheckMailbox
Sends a 'CHECK' command to the server, asking it to perform any neccessary 'housekeeping' operations on, and update the state of the currently selected mailbox.
a_ExpungeMailbox
Permanently remove all messages that have the 'Deleted' flag set from the current (selected) mailbox.
a_CloseMailbox
Permanently remove all messages that have the 'Deleted' flag set from the current (selected) mailbox, and then close (deselect) the mailbox.
a_ListMailboxes
List all mailboxes matching the criteria in the Mailbox property. Matching mailboxes are returned through the MailboxList event.
a_ListSubscribedMailboxes
List all subscribed mailboxes matching the criteria in the Mailbox property. Matching mailboxes are returned through MailboxList event.
a_SubscribeMailbox
Subscribe to the mailbox specified by the Mailbox property.
a_UnsubscribeMailbox
Unsubscribe from the mailbox specified by the Mailbox property.
a_GetMessageInfo
Retrieves message information for the messages specified by the MessageSet property. This includes information about the message envelope as well as message structure. Every time a message envelope is retrieved, a MessageInfo event is fired, and message envelope information is stored in properties such as: MessageSubject , MessageFrom , MessageTo , MessageCc , etc.. If the message is a multipart message, one or more MessagePart events are fired before the MessageInfo event - one for each message part.
a_GetMessageHeaders
Retrieves RFC822 headers of the message specified by MessageSet and stores them in the MessageHeaders property.
a_GetMessageText
Retrieves the RFC822-encoded text of the message specified by MessageSet . If the LocalFile property contains a file name, the text is stored in LocalFile , and the Transfer events denote the progress. If the LocalFile property contains an empty string, the text is stored in the MessageText property, as well as provided through the Transfer event.
a_GetMessagePart
Retrieves the contents message part specified by the PartId property of the message specified by the MessageSet property. If the LocalFile property contains a file name, the message part is stored in LocalFile , and the Transfer events denote the progress. If the LocalFile property contains an empty string, the message part is stored in the MessageText property, as well as provided through the Transfer event.
a_ResetMessageFlags
Replace the flags of the messages specified by the MessageSet property with the flags specified by the MessageFlags property. The format of the flags is specified by the IMAP RFCs.
a_SetMessageFlags
Add the flags specified by the MessageFlags property to the messages specified by the MessageSet property. The format of the flags is specified by the IMAP RFCs.
a_UnsetMessageFlags
Remove the flags specified by the MessageFlags property from the messages specified by the MessageSet property. The format of the flags is specified by the IMAP RFCs.


setAction

public void setAction(int action)
               throws IPWorksException
An action code for the component. Setting the Action property to a valid action code makes the class perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

Each action sends a command to the server, and waits until a reply is received. If there is no connection to the server, a connection is established automatically using the 'Connect' action below.

The following are the possible values for the Action property and the corresponding descriptions:

a_Idle
Default action. It can also be used to interrupt the current operation.
a_Noop
Sends an IMAP 'NOOP' command to the server. This is useful when the connection needs to be kept alive for long periods of time. (Normally, servers break the connection automatically after 30 minutes of inactivity).
a_Connect
Connect to the IMAP server specified by MailServer and authenticate using the user name and password supplied in the User and Password properties.
a_Disconnect
Logout and disconnect from the IMAP server.
a_SelectMailbox
Ask the server to select the mailbox specified in the Mailbox property. The mailbox is selected in read/write mode (if the server permits).
a_ExamineMailbox
Ask the server to select the mailbox specified in the Mailbox property in read-only mode.
a_CreateMailbox
Create a new mailbox. The mailbox name is specified by the Mailbox property.
a_DeleteMailbox
Delete a mailbox. The mailbox name is specified by the Mailbox property.
a_RenameMailbox
Rename a mailbox. The mailbox is specified by the Mailbox property, and the new name is specified by the NewMailbox property.
a_SearchMailbox
Search the selected mailbox using the criteria specified in the SearchCriteria property. For every message matching the criteria, the equivalent of a 'Get Message Info' action is performed and a MessageInfo event is fired. For more information about the format of the search criteria, please refer to the SearchCriteria property.
a_AppendToMailbox
Appends the RFC822-encoded message in MessageText to the mailbox specified by Mailbox . If the MessageFlags property is not an empty string, it's contents are supplied with the 'APPEND' command sent to the server.
a_CopyToMailbox
Copies the messages specified by the MessageSet property to the mailbox specified by the Mailbox property.
a_CheckMailbox
Sends a 'CHECK' command to the server, asking it to perform any neccessary 'housekeeping' operations on, and update the state of the currently selected mailbox.
a_ExpungeMailbox
Permanently remove all messages that have the 'Deleted' flag set from the current (selected) mailbox.
a_CloseMailbox
Permanently remove all messages that have the 'Deleted' flag set from the current (selected) mailbox, and then close (deselect) the mailbox.
a_ListMailboxes
List all mailboxes matching the criteria in the Mailbox property. Matching mailboxes are returned through the MailboxList event.
a_ListSubscribedMailboxes
List all subscribed mailboxes matching the criteria in the Mailbox property. Matching mailboxes are returned through MailboxList event.
a_SubscribeMailbox
Subscribe to the mailbox specified by the Mailbox property.
a_UnsubscribeMailbox
Unsubscribe from the mailbox specified by the Mailbox property.
a_GetMessageInfo
Retrieves message information for the messages specified by the MessageSet property. This includes information about the message envelope as well as message structure. Every time a message envelope is retrieved, a MessageInfo event is fired, and message envelope information is stored in properties such as: MessageSubject , MessageFrom , MessageTo , MessageCc , etc.. If the message is a multipart message, one or more MessagePart events are fired before the MessageInfo event - one for each message part.
a_GetMessageHeaders
Retrieves RFC822 headers of the message specified by MessageSet and stores them in the MessageHeaders property.
a_GetMessageText
Retrieves the RFC822-encoded text of the message specified by MessageSet . If the LocalFile property contains a file name, the text is stored in LocalFile , and the Transfer events denote the progress. If the LocalFile property contains an empty string, the text is stored in the MessageText property, as well as provided through the Transfer event.
a_GetMessagePart
Retrieves the contents message part specified by the PartId property of the message specified by the MessageSet property. If the LocalFile property contains a file name, the message part is stored in LocalFile , and the Transfer events denote the progress. If the LocalFile property contains an empty string, the message part is stored in the MessageText property, as well as provided through the Transfer event.
a_ResetMessageFlags
Replace the flags of the messages specified by the MessageSet property with the flags specified by the MessageFlags property. The format of the flags is specified by the IMAP RFCs.
a_SetMessageFlags
Add the flags specified by the MessageFlags property to the messages specified by the MessageSet property. The format of the flags is specified by the IMAP RFCs.
a_UnsetMessageFlags
Remove the flags specified by the MessageFlags property from the messages specified by the MessageSet property. The format of the flags is specified by the IMAP RFCs.


setCommand

public void setCommand(java.lang.String command)
                throws IPWorksException
Can be used to send additional commands directly to the IMAP server. Setting the Command property directs the class to send the assigned command to the MailServer . Check the LastReply property and/or trap the PITrail events comming from the server to get the response(s).


getLastReply

public java.lang.String getLastReply()
The last reply from the server. This is latest reply received from the server. It can be used for information purposes. More information can be retrieved through the PITrail event.


getLocalFile

public java.lang.String getLocalFile()
The path to a local file for downloading the message body. If the file exists, it is overwritten (optional). The LocalFile property is used when retrieving a message via the Action property. If LocalFile is empty then the received data is provided through the parameters of the Transfer event.


setLocalFile

public void setLocalFile(java.lang.String localFile)
                  throws IPWorksException
The path to a local file for downloading the message body. If the file exists, it is overwritten (optional). The LocalFile property is used when retrieving a message via the Action property. If LocalFile is empty then the received data is provided through the parameters of the Transfer event.


getMailbox

public java.lang.String getMailbox()
Name of the mailbox selected on the server. Also used as argument to many other actions. For more information please refer to the Action property.


setMailbox

public void setMailbox(java.lang.String mailbox)
                throws IPWorksException
Name of the mailbox selected on the server. Also used as argument to many other actions. For more information please refer to the Action property.


getMailboxFlags

public java.lang.String getMailboxFlags()
Defined flags in the selected mailbox. The class fills out MessageCount , RecentMessageCount , and MailboxFlags after connecting to the MailServer and selecting or examining a Mailbox .


getMailPort

public int getMailPort()
The port of the IMAP server (default 143). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed while a connection is in progress. Any attempt to change the MailPort property while connected will fail with an error.


setMailPort

public void setMailPort(int mailPort)
                 throws IPWorksException
The port of the IMAP server (default 143). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed while a connection is in progress. Any attempt to change the MailPort property while connected will fail with an error.


getMailServer

public java.lang.String getMailServer()
The name or address of the mail server (IMAP server). The MailServer property specifies the IP address (IP number in dotted internet format) or Domain Name of the mail server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the MailServer property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the MailServer property is set to the corresponding address. If the search is not successful, an error is returned.


setMailServer

public void setMailServer(java.lang.String mailServer)
                   throws IPWorksException
The name or address of the mail server (IMAP server). The MailServer property specifies the IP address (IP number in dotted internet format) or Domain Name of the mail server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the MailServer property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the MailServer property is set to the corresponding address. If the search is not successful, an error is returned.


getMessageBCc

public java.lang.String getMessageBCc(int addressIndex)
                               throws IPWorksException
Array property with the list of BCc recipients of the message. Recipient addresses are provided in the array starting from index 0 and going up. After the last address, empty strings are returned.

The BCc addresses are never shown to any of the recipients of the message but are stored in the original outgoing message.


getMessageCc

public java.lang.String getMessageCc(int addressIndex)
                              throws IPWorksException
Array property with the list of Cc recipients of the message. Recipient addresses are provided in the array starting from index 0 and going up. After the last address, empty strings are returned.


getMessageContentEncoding

public java.lang.String getMessageContentEncoding()
The ContentEncoding of the selected message. The property is set when message information is retrieved via the 'Get Message Info' Action .


getMessageContentType

public java.lang.String getMessageContentType()
The ContentType of the message. The MessageContentType property denotes the type of content contained in the message, such as plain, multipart, multipart/alternative etc. You may eventually need to check the MessageContentEncoding property or read the individual message parts.


getMessageCount

public int getMessageCount()
The total number of messages on the Mailbox . The class fills out MessageCount , RecentMessageCount , and MailboxFlags after connecting to the MailServer and selecting or examining a Mailbox .


getMessageDate

public java.lang.String getMessageDate()
The time the message was created. The MessageDate holds the date and time when the message was created. The format is described in RFC821.


getMessageDeliveryTime

public java.lang.String getMessageDeliveryTime()
The time the message was delivered to the mail server. The time format is defined in RFC821.


getMessageFlags

public java.lang.String getMessageFlags()
Flags of the current message. Also used to specify flags when an 'Append To Mailbox' operation is specified through the Action property.


setMessageFlags

public void setMessageFlags(java.lang.String messageFlags)
                     throws IPWorksException
Flags of the current message. Also used to specify flags when an 'Append To Mailbox' operation is specified through the Action property.


getMessageFrom

public java.lang.String getMessageFrom()
The address of the author of the message. MessageFrom has normally the same value as MessageSender .

There are cases when a message may have more than one From address. If this is the case, the addresses are provided in the MessageFrom property separated by commas.


getMessageHeaders

public java.lang.String getMessageHeaders()
RFC822-encoded headers of the message. This property holds the full headers of the message in RFC822 format. The headers are retrieved through the 'Get Message Headers' Action .


setMessageHeaders

public void setMessageHeaders(java.lang.String messageHeaders)
                       throws IPWorksException
RFC822-encoded headers of the message. This property holds the full headers of the message in RFC822 format. The headers are retrieved through the 'Get Message Headers' Action .


getMessageId

public java.lang.String getMessageId()
The message id of the current message. The class fills out the MessageId property when message information is retrieved from the MailServer through the Action property.

The id is permanent if UIDMode is set, and temporary otherwise.


getMessageInReplyTo

public java.lang.String getMessageInReplyTo()
The unique message ID of the message this one is in reply to. The class fills out MessageInReplyTo with the value of the In-Reply-To: message header.

This value can be useful when threading messages by referring to the message you are replying to.

The unique message Id of the message itself is given by the MessageNetId property.


getMessageNetId

public java.lang.String getMessageNetId()
The globally unique id of the message. The class fills the MessageId with the value of the Message-Id: header. This is a globally unique value normally created by the first mail server the message is sent to.


getMessageReplyTo

public java.lang.String getMessageReplyTo()
Email address(s) where replies to the message should be sent. There are cases when a message may have more than one Reply-To address. If this is the case, the addresses are provided in the MessageReplyTo property separated by commas.


getMessageSender

public java.lang.String getMessageSender()
The address of the sender of the message. MessageSender has normally the same value as MessageFrom .

There are cases when a message may have more than one sender. If this is the case, the addresses are provided in the MessageSender property separated by commas.


getMessageSet

public java.lang.String getMessageSet()
The set of messages to operate on. Used as an argument to most actions triggered by the Action property.

It may consist of a single message number, a range of messages specified by two message numbers separated by ':' (e.g. "1:5"), and/or individual message numbers separated by ',' (e.g. "1:5,7,10").


setMessageSet

public void setMessageSet(java.lang.String messageSet)
                   throws IPWorksException
The set of messages to operate on. Used as an argument to most actions triggered by the Action property.

It may consist of a single message number, a range of messages specified by two message numbers separated by ':' (e.g. "1:5"), and/or individual message numbers separated by ',' (e.g. "1:5,7,10").


getMessageSize

public int getMessageSize()
The size of the selected message. The class fills out the MessageSize property when message information is retrieved from the MailServer through the Action property.


getMessageSubject

public java.lang.String getMessageSubject()
The subject of the message. The class fills out the MessageSubject property when message information is retrieved from the MailServer through the Action property.


getMessageText

public java.lang.String getMessageText()
The body of the retrieved message The class fills out MessageText with the contents of the message body (in RFC822 format) when a 'Get Message Text' operation is triggered via the Action property.


setMessageText

public void setMessageText(java.lang.String messageText)
                    throws IPWorksException
The body of the retrieved message The class fills out MessageText with the contents of the message body (in RFC822 format) when a 'Get Message Text' operation is triggered via the Action property.


getMessageTo

public java.lang.String getMessageTo(int addressIndex)
                              throws IPWorksException
Array property with the list of direct recipients of the message. Recipient addresses are provided in the array starting from index 0 and going up. After the last address, empty strings are returned.


getNewMailbox

public java.lang.String getNewMailbox()
The new name of the mailbox during a 'Rename Mailbox' operation. Mailboxes are renamed by setting the Action property to the corresponding action value.


setNewMailbox

public void setNewMailbox(java.lang.String newMailbox)
                   throws IPWorksException
The new name of the mailbox during a 'Rename Mailbox' operation. Mailboxes are renamed by setting the Action property to the corresponding action value.


getPartId

public java.lang.String getPartId()
The PartId of the part to retrieve. The class will retrieve the part specified in PartId when Action is set to imapGetMessagePart .

The part id-s of each message part (if any) are provided through the corresponding MessagePart events.


setPartId

public void setPartId(java.lang.String partId)
               throws IPWorksException
The PartId of the part to retrieve. The class will retrieve the part specified in PartId when Action is set to imapGetMessagePart .

The part id-s of each message part (if any) are provided through the corresponding MessagePart events.


getPassword

public java.lang.String getPassword()
The password used to authenticate to the MailServer . Both the User and Password properties must be set before connecting to the MailServer .


setPassword

public void setPassword(java.lang.String password)
                 throws IPWorksException
The password used to authenticate to the MailServer . Both the User and Password properties must be set before connecting to the MailServer .


getRecentMessageCount

public int getRecentMessageCount()
Number of new messages on the Mailbox . The class fills out MessageCount , RecentMessageCount , and MailboxFlags after connecting to the MailServer and selecting or examining a Mailbox .


getSearchCriteria

public java.lang.String getSearchCriteria()
Search criteria to use for search operations. The exact format of the search criteria is specified by the IMAP RFCs. The string consists of one or more search keys and their corresponding values (if any) separated by spaces, for example: "SINCE 1-Feb-1994 NOT FROM Smith".

Possible search keys include:

<message set>
Messages with message sequence numbers corresponding to the specified message sequence number set
ALL
All messages in the mailbox - this is the default initial key for AND-ing.
ANSWERED
Messages with the \\Answered flag set.
BCC <string>
Messages that contain the specified string in the envelope structure's BCC field.
BEFORE <date>
Messages whose internal date is earlier than the specified date.
BODY <string>
Messages that contain the specified string in the body of the message.
CC <string>
Messages that contain the specified string in the envelope structure's CC field.
DELETED
Messages with the \\Deleted flag set.
DRAFT
Messages with the \\Draft flag set.
FLAGGED
Messages with the \\Flagged flag set.
FROM <string>
Messages that contain the specified string in the envelope structure's FROM field.
HEADER <field-name> <string>
Messages that have a header with the specified field-name (as defined in [RFC-822]) and that contains the specified string in the [RFC-822] field-body.
KEYWORD <flag>
Messages with the specified keyword set.
LARGER <n>
Messages with an RFC822.SIZE larger than the specified number of octets.
NEW
Messages that have the \\Recent flag set but not the \\Seen flag. This is functionally equivalent to "(RECENT UNSEEN)".
NOT <search-key>
Messages that do not match the specified search key.
OLD
Messages that do not have the \\Recent flag set. This is functionally equivalent to "NOT RECENT" (as opposed to "NOT NEW").
ON <date>
Messages whose internal date is within the specified date.
OR <search-key1> <search-key2>
Messages that match either search key.
RECENT
Messages that have the \\Recent flag set.
SEEN
Messages that have the \\Seen flag set.
SENTBEFORE <date>
Messages whose [RFC-822] Date: header is earlier than the specified date.
SENTON <date>
Messages whose [RFC-822] Date: header is within the specified date.
SENTSINCE <date>
Messages whose [RFC-822] Date: header is within or later than the specified date.
SINCE <date>
Messages whose internal date is within or later than the specified date.
SMALLER <n>
Messages with an RFC822.SIZE smaller than the specified number of octets.
SUBJECT <string>
Messages that contain the specified string in the envelope structure's SUBJECT field.
TEXT <string>
Messages that contain the specified string in the header or body of the message.
TO <string>
Messages that contain the specified string in the envelope structure's TO field.
UID <message set>
Messages with unique identifiers corresponding to the specified unique identifier set.
UNANSWERED
Messages that do not have the \\Answered flag set.
UNDELETED
Messages that do not have the \\Deleted flag set.
UNDRAFT
Messages that do not have the \\Draft flag set.
UNFLAGGED
Messages that do not have the \\Flagged flag set.
UNKEYWORD <flag>
Messages that do not have the specified keyword set.
UNSEEN
Messages that do not have the \\Seen flag set.


setSearchCriteria

public void setSearchCriteria(java.lang.String searchCriteria)
                       throws IPWorksException
Search criteria to use for search operations. The exact format of the search criteria is specified by the IMAP RFCs. The string consists of one or more search keys and their corresponding values (if any) separated by spaces, for example: "SINCE 1-Feb-1994 NOT FROM Smith".

Possible search keys include:

<message set>
Messages with message sequence numbers corresponding to the specified message sequence number set
ALL
All messages in the mailbox - this is the default initial key for AND-ing.
ANSWERED
Messages with the \\Answered flag set.
BCC <string>
Messages that contain the specified string in the envelope structure's BCC field.
BEFORE <date>
Messages whose internal date is earlier than the specified date.
BODY <string>
Messages that contain the specified string in the body of the message.
CC <string>
Messages that contain the specified string in the envelope structure's CC field.
DELETED
Messages with the \\Deleted flag set.
DRAFT
Messages with the \\Draft flag set.
FLAGGED
Messages with the \\Flagged flag set.
FROM <string>
Messages that contain the specified string in the envelope structure's FROM field.
HEADER <field-name> <string>
Messages that have a header with the specified field-name (as defined in [RFC-822]) and that contains the specified string in the [RFC-822] field-body.
KEYWORD <flag>
Messages with the specified keyword set.
LARGER <n>
Messages with an RFC822.SIZE larger than the specified number of octets.
NEW
Messages that have the \\Recent flag set but not the \\Seen flag. This is functionally equivalent to "(RECENT UNSEEN)".
NOT <search-key>
Messages that do not match the specified search key.
OLD
Messages that do not have the \\Recent flag set. This is functionally equivalent to "NOT RECENT" (as opposed to "NOT NEW").
ON <date>
Messages whose internal date is within the specified date.
OR <search-key1> <search-key2>
Messages that match either search key.
RECENT
Messages that have the \\Recent flag set.
SEEN
Messages that have the \\Seen flag set.
SENTBEFORE <date>
Messages whose [RFC-822] Date: header is earlier than the specified date.
SENTON <date>
Messages whose [RFC-822] Date: header is within the specified date.
SENTSINCE <date>
Messages whose [RFC-822] Date: header is within or later than the specified date.
SINCE <date>
Messages whose internal date is within or later than the specified date.
SMALLER <n>
Messages with an RFC822.SIZE smaller than the specified number of octets.
SUBJECT <string>
Messages that contain the specified string in the envelope structure's SUBJECT field.
TEXT <string>
Messages that contain the specified string in the header or body of the message.
TO <string>
Messages that contain the specified string in the envelope structure's TO field.
UID <message set>
Messages with unique identifiers corresponding to the specified unique identifier set.
UNANSWERED
Messages that do not have the \\Answered flag set.
UNDELETED
Messages that do not have the \\Deleted flag set.
UNDRAFT
Messages that do not have the \\Draft flag set.
UNFLAGGED
Messages that do not have the \\Flagged flag set.
UNKEYWORD <flag>
Messages that do not have the specified keyword set.
UNSEEN
Messages that do not have the \\Seen flag set.


isUIDMode

public boolean isUIDMode()
If true, permanent message id-s are used instead of the default temporary id-s. Normally, the IMAP server uses temporary message id-s that are valid only during the current session. If UIDMode is true, permanent message id-s are used instead.

The IMAP protocol operations where UID mode is used are the following: COPY , FETCH , STORE , SEARCH .


setUIDMode

public void setUIDMode(boolean UIDMode)
                throws IPWorksException
If true, permanent message id-s are used instead of the default temporary id-s. Normally, the IMAP server uses temporary message id-s that are valid only during the current session. If UIDMode is true, permanent message id-s are used instead.

The IMAP protocol operations where UID mode is used are the following: COPY , FETCH , STORE , SEARCH .


getUser

public java.lang.String getUser()
The user name used to authenticate to the MailServer . Both the User and Password properties must be set before connecting to the MailServer .


setUser

public void setUser(java.lang.String user)
             throws IPWorksException
The user name used to authenticate to the MailServer . Both the User and Password properties must be set before connecting to the MailServer .


getLocalHost

public java.lang.String getLocalHost()
The name of the local host. When connected, the IP address of the interface through which the connection was made. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call.

If the class is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).


fireError

public void fireError(int errorCode,
                      java.lang.String description)
Information about errors during data delivery. (Called internally to dispatch the event.)
See Also:
ImapErrorEvent

firePITrail

public void firePITrail(int direction,
                        java.lang.String message)
Traces the commands sent to the mail server, and the respective replies. (Called internally to dispatch the event.)
See Also:
ImapPITrailEvent

fireMailboxList

public void fireMailboxList(java.lang.String mailbox,
                            java.lang.String separator,
                            java.lang.String flags)
Fired for each mailbox received through the various 'List Mailbox' actions. (Called internally to dispatch the event.)
See Also:
ImapMailboxListEvent

fireMessageInfo

public void fireMessageInfo(java.lang.String messageId,
                            java.lang.String subject,
                            java.lang.String date,
                            java.lang.String from,
                            int size)
Fired with information for the message(s) retrieved by the server. (Called internally to dispatch the event.)
See Also:
ImapMessageInfoEvent

fireMessagePart

public void fireMessagePart(java.lang.String partId,
                            int size,
                            java.lang.String contentType,
                            java.lang.String filename,
                            java.lang.String contentEncoding,
                            java.lang.String parameters,
                            java.lang.String multipartMode)
Fired for each message part when a 'Get Message Info' action is performed. (Called internally to dispatch the event.)
See Also:
ImapMessagePartEvent

fireEndTransfer

public void fireEndTransfer()
Fired when the message or the part data finishes transferring. (Called internally to dispatch the event.)
See Also:
ImapEndTransferEvent

fireStartTransfer

public void fireStartTransfer()
Fired when the message or the part data starts transferring. (Called internally to dispatch the event.)
See Also:
ImapStartTransferEvent

fireTransfer

public void fireTransfer(int bytesTransferred,
                         java.lang.String text)
Fired while the message gets transferred from the MailServer . (Called internally to dispatch the event.)
See Also:
ImapTransferEvent

addImapEventListener

public void addImapEventListener(ImapEventListener l)
                          throws java.util.TooManyListenersException

removeImapEventListener

public void removeImapEventListener(ImapEventListener l)

IP*Works!

Copyright (c) 1995-2000 by /n software inc. - All rights reserved.