|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ipworks.Imap
The IMAP bean is used to communicate with IMAP servers using the IMAP (Internet Message Access) protocol.
The IMAP bean implements a standard IMAP client as specified in RFC 1730 and RFC 2060.
The first step in using the bean 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 bean's
methods. 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 ExamineMailbox method. 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 bean's methods.
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 SortCriteria , 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 FetchMessagePart method.
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 |
amCRAMMD5
|
static int |
amNTLM
|
static int |
amUserPassword
|
| Constructor Summary | |
Imap()
|
|
| Method Summary | |
void |
addImapEventListener(ipworks.ImapEventListener l)
|
void |
addMessageFlags(java.lang.String flags)
Add the specified flags to the messages specified by MessageSet . |
void |
appendToMailbox()
Appends the message in MessageText to the mailbox specified by Mailbox . |
void |
checkMailbox()
Sends a 'CHECK' command to the server. |
void |
closeMailbox()
Remove all messages marked with 'Deleted' flag from the currently selected mailbox and unselect mailbox. |
java.lang.String |
config(java.lang.String configurationString)
Sets or retrieves a beanconfiguration setting. |
void |
connect()
Connect to an IMAP server. |
void |
copyToMailbox()
Copies the messages specified by MessageSet to the mailbox specified by Mailbox . |
void |
createMailbox()
Create a new mailbox specified by Mailbox . |
void |
deleteFromMailbox()
Marks the messages specified by MessageSet as deleted. |
void |
deleteMailbox()
Delete a mailbox specified by Mailbox . |
void |
deleteMailboxACL(java.lang.String user)
Deletes mailbox access control rights for a specific user. |
void |
disconnect()
Disconnect from an IMAP server. |
void |
doEvents()
Processes events from the internal message queue. |
void |
examineMailbox()
Select a Mailbox (Read-only mode). |
void |
expungeMailbox()
Remove all messages marked with 'Deleted' flag from the currently selected mailbox. |
void |
fetchMessageHeaders()
Get the message headers of messages specified by the MessageSet property. |
void |
fetchMessageInfo()
Get information about messages specified by the MessageSet property. |
void |
fetchMessagePart(java.lang.String partId)
Get the message part specified by PartId. |
void |
fetchMessageText()
Get the message text of messages specified by the MessageSet property. |
int |
getAuthMechanism()
The authentication mechanism to be used when connecting to the mail server. |
int |
getEndByte()
The byte index of the position where the transfer should end. |
ipworks.Firewall |
getFirewall()
A set of properties related to firewall access. |
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 or user-assigned IP interface through which connections are initiated or accepted. |
java.lang.String |
getMailbox()
Name of the mailbox selected on the server. |
void |
getMailboxACL()
Gets mailbox access control rights. |
java.lang.String |
getMailboxFlags()
Defined flags in the selected mailbox. |
MailboxList |
getMailboxList()
Collection of mailboxes listed by the server. |
int |
getMailPort()
The port of the IMAP server (default is 143). |
java.lang.String |
getMailServer()
The name or address of the mail server (IMAP server). |
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()
Contains the flags of the current message. |
java.lang.String |
getMessageFrom()
The address of the author of the message. |
HeaderList |
getMessageHeaders()
Collection of RFC822-encoded headers of the message. |
java.lang.String |
getMessageHeadersString()
String version of RFC822-encoded headers of the message. |
java.lang.String |
getMessageId()
The message id of the current message. |
MessageInfoList |
getMessageInfo()
Collection of messages retrieved by FetchMessageInfo . |
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. |
MessagePartList |
getMessageParts()
Collection of message parts collected by FetchMessageInfo . |
MessageRecipientList |
getMessageRecipients()
Collection of recipients for the current 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 |
java.lang.String |
getPassword()
The password used to authenticate to the MailServer . |
int |
getRecentMessageCount()
Number of new messages on the Mailbox . |
java.lang.String |
getSortCriteria()
Sort criteria to use for message retrieval operations. |
int |
getStartByte()
The byte index of the position where the transfer should start. |
int |
getTimeout()
A timeout for the bean. |
java.lang.String |
getUIDValidity()
The UIDValidity parameter sent from the server in response to SelectMailbox command. |
java.lang.String |
getUser()
The user name used to authenticate to the MailServer . |
void |
interrupt()
Interrupt the current method. |
boolean |
isAutoDecodeParts()
Determines whether to automatically decode message parts. |
boolean |
isConnected()
Shows whether the bean is connected. |
boolean |
isIdle()
The current status of the component. |
boolean |
isPeekMode()
When set to True, the message Seen flag is not changed during reading. |
boolean |
isUIDMode()
If true, permanent message id-s are used instead of the default temporary id-s. |
void |
listMailboxes()
List all mailboxes matching all criteria in the Mailbox property. |
void |
listSubscribedMailboxes()
List all subscribed mailboxes matching all criteria in the Mailbox property. |
java.lang.String |
localizeDate(java.lang.String dateTime)
Converts a valid RFC 822 message date to local date and time. |
void |
moveToMailbox()
Moves the messages specified by MessageSet to the mailbox specified by Mailbox . |
void |
noop()
Sends a 'NOOP' command to the server. |
void |
removeImapEventListener(ipworks.ImapEventListener l)
|
void |
renameMailbox(java.lang.String newName)
Change the name of Mailbox to NewName . |
void |
resetMessageFlags()
Replace the flags of the messages specified by MessageSet with the flags specified by MessageFlags . |
void |
searchMailbox(java.lang.String searchCriteria)
Search selected mailbox for specified text. |
void |
selectMailbox()
Select a Mailbox. |
void |
setAuthMechanism(int authMechanism)
The authentication mechanism to be used when connecting to the mail server. |
void |
setAutoDecodeParts(boolean autoDecodeParts)
Determines whether to automatically decode message parts. |
void |
setCommand(java.lang.String command)
Can be used to send additional commands directly to the server. |
void |
setConnected(boolean connected)
Shows whether the bean is connected. |
void |
setEndByte(int endByte)
The byte index of the position where the transfer should end. |
void |
setFirewall(ipworks.Firewall firewall)
A set of properties related to firewall access. |
void |
setLocalFile(java.lang.String localFile)
The path to a local file for downloading the message body. |
void |
setLocalHost(java.lang.String localHost)
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
void |
setMailbox(java.lang.String mailbox)
Name of the mailbox selected on the server. |
void |
setMailboxACL(java.lang.String user,
java.lang.String rights)
Sets mailbox access control rights for a specific user. |
void |
setMailPort(int mailPort)
The port of the IMAP server (default is 143). |
void |
setMailServer(java.lang.String mailServer)
The name or address of the mail server (IMAP server). |
void |
setMessageFlags(java.lang.String messageFlags)
Contains the flags of the current message. |
void |
setMessageHeaders(HeaderList messageHeaders)
Collection of RFC822-encoded headers of the message. |
void |
setMessageHeadersString(java.lang.String messageHeadersString)
String version of RFC822-encoded headers of the message. |
void |
setMessageSet(java.lang.String messageSet)
The set of messages to operate on. |
void |
setMessageStream(java.io.OutputStream messageStream)
Sets the stream to which the message (or message part) downloaded from the server will be written. |
void |
setMessageText(java.lang.String messageText)
The body of the retrieved message |
void |
setPassword(java.lang.String password)
The password used to authenticate to the MailServer . |
void |
setPeekMode(boolean peekMode)
When set to True, the message Seen flag is not changed during reading. |
void |
setSortCriteria(java.lang.String sortCriteria)
Sort criteria to use for message retrieval operations. |
void |
setStartByte(int startByte)
The byte index of the position where the transfer should start. |
void |
setTimeout(int timeout)
A timeout for the bean. |
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 . |
void |
subscribeMailbox()
Subscribe to the mailbox specified by Mailbox . |
void |
unsetMessageFlags()
Remove the flags specified by MessageFlags from the messages specified by MessageSet . |
void |
unsubscribeMailbox()
Unsubscribe from the mailbox specified by Mailbox . |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int amUserPassword
public static final int amCRAMMD5
public static final int amNTLM
| Constructor Detail |
public Imap()
| Method Detail |
public int getAuthMechanism()
By default, AuthMechanism is amUserPassword (0), and default plaintext
authentication is used to login to the server. If AuthMechanism is set
to amCRAMMD5 (1), the more secure CRAM-MD5 authentication is used instead.
If AuthMechanism is set to amNTLM (2) NTLM authentication will be used.
This option is only available in the SSL package.
public void setAuthMechanism(int authMechanism)
throws IPWorksException
By default, AuthMechanism is amUserPassword (0), and default plaintext
authentication is used to login to the server. If AuthMechanism is set
to amCRAMMD5 (1), the more secure CRAM-MD5 authentication is used instead.
If AuthMechanism is set to amNTLM (2) NTLM authentication will be used.
This option is only available in the SSL package.
IPWorksExceptionpublic boolean isAutoDecodeParts()
Message parts, especially binary message parts, are normally sent by the server encoded (Base64 or other format). If this setting is True, the parts are automatically decoded while being received.
public void setAutoDecodeParts(boolean autoDecodeParts)
throws IPWorksException
Message parts, especially binary message parts, are normally sent by the server encoded (Base64 or other format). If this setting is True, the parts are automatically decoded while being received.
IPWorksException
public void setCommand(java.lang.String command)
throws IPWorksException
Setting the Command property directs the bean 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).
IPWorksExceptionpublic boolean isConnected()
Use this property to determine whether the bean is connected to the remote host or not.
public void setConnected(boolean connected)
throws IPWorksException
Use this property to determine whether the bean is connected to the remote host or not.
IPWorksExceptionpublic int getEndByte()
StartByte and EndByte are used together with the FetchMessagePart method to specify the portion
of the message part to be retrieved from the server.
When StartByte or EndByte contain values other than the
defaults (0), only the corresponding portion of the message part
is retrieved from the server.
Byte indexes start from 1. The default value for EndByte is 0, which
corresponds to the end of the message.
public void setEndByte(int endByte)
throws IPWorksException
StartByte and EndByte are used together with the FetchMessagePart method to specify the portion
of the message part to be retrieved from the server.
When StartByte or EndByte contain values other than the
defaults (0), only the corresponding portion of the message part
is retrieved from the server.
Byte indexes start from 1. The default value for EndByte is 0, which
corresponds to the end of the message.
IPWorksExceptionpublic ipworks.Firewall getFirewall()
This is a FIREWALL type property which
contains fields describing the firewall
through which the bean will attempt to connect.
public void setFirewall(ipworks.Firewall firewall)
throws IPWorksException
This is a FIREWALL type property which
contains fields describing the firewall
through which the bean will attempt to connect.
IPWorksExceptionpublic boolean isIdle()
Idle will be False if the component is currently busy (communicating
and/or waiting for an answer), and True at all other times.
public java.lang.String getLastReply()
This is the last reply received from the server. It
can be used for information purposes. The same information
and more can also be retrieved through the PITrail event.
public java.lang.String getLocalFile()
The LocalFile property is used when retrieving a message.
If LocalFile is empty then
the received data is provided through the parameters of the Transfer event.
public void setLocalFile(java.lang.String localFile)
throws IPWorksException
The LocalFile property is used when retrieving a message.
If LocalFile is empty then
the received data is provided through the parameters of the Transfer event.
IPWorksExceptionpublic java.lang.String getLocalHost()
The LocalHost property contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean 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).
NOTE: LocalHost is not persistent. You must always set it in
code, and never in the property window.
public void setLocalHost(java.lang.String localHost)
throws IPWorksException
The LocalHost property contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean 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).
NOTE: LocalHost is not persistent. You must always set it in
code, and never in the property window.
IPWorksExceptionpublic java.lang.String getMailbox()
Also used as argument to most methods. Please refer to the bean methods for more information.
Example (Open a Mailbox in Read/Write Mode)
IMAPControl.Mailbox = "INBOX"
IMAPControl.SelectMailbox
Example (Open a Mailbox in Read-Only Mode)
IMAPControl.Mailbox = "INBOX.Folder"
IMAPControl.ExamineMailbox
public void setMailbox(java.lang.String mailbox)
throws IPWorksException
Also used as argument to most methods. Please refer to the bean methods for more information.
Example (Open a Mailbox in Read/Write Mode)
IMAPControl.Mailbox = "INBOX"
IMAPControl.SelectMailbox
Example (Open a Mailbox in Read-Only Mode)
IMAPControl.Mailbox = "INBOX.Folder"
IMAPControl.ExamineMailbox
IPWorksExceptionpublic java.lang.String getMailboxFlags()
The bean fills out MessageCount , RecentMessageCount ,
and MailboxFlags after connecting to the MailServer and selecting
or examining a Mailbox .
public MailboxList getMailboxList()
This collection contains a list of mailboxes returned by the server
when ListMailboxes or ListSubscribedMailboxes is called.
MaxMailboxescan be used to control the number of mailboxes saved.
This collection is indexed from 0 to Count - 1.
public int getMailPort()
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 once a connection is established. Any attempt to change this property while connected will fail with an error.
public void setMailPort(int mailPort)
throws IPWorksException
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 once a connection is established. Any attempt to change this property while connected will fail with an error.
IPWorksExceptionpublic java.lang.String getMailServer()
The MailServer property specifies the IP address (IP number in
dotted internet format) or Domain Name of the mail server.
It must be 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. 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.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceeded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
public void setMailServer(java.lang.String mailServer)
throws IPWorksException
The MailServer property specifies the IP address (IP number in
dotted internet format) or Domain Name of the mail server.
It must be 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. 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.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceeded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
IPWorksExceptionpublic java.lang.String getMessageContentEncoding()
The property is automatically set by the bean when message information is retrieved via the FetchMessageInfo method.
public java.lang.String getMessageContentType()
The MessageContentType property denotes the type of content contained
in the message, such as plain, multipart, multipart/alternative etc.
You may also need to check the MessageContentEncoding property
or read the individual message parts.
public int getMessageCount()
Mailbox .
The bean fills out MessageCount , RecentMessageCount ,
and MailboxFlags after connecting to the MailServer and selecting
or examining a Mailbox .
public java.lang.String getMessageDate()
The MessageDate holds the date and time when the message
was created.
RFC 822 contains detailed date format specifications. An example of a valid date is "Fri, 1 Mar 96 21:24:52 EST".
public java.lang.String getMessageDeliveryTime()
The time format is defined in RFC821.
public java.lang.String getMessageFlags()
Contains the flags of the current message. It is also used to specify flags when AppendToMailbox is called.
Examples of possible flag values are server dependent, but can include:
ExpungeMailbox ).
IMAPControl.MessageSet = "1"
IMAPControl.AddMessageFlags("\\Deleted")
public void setMessageFlags(java.lang.String messageFlags)
throws IPWorksException
Contains the flags of the current message. It is also used to specify flags when AppendToMailbox is called.
Examples of possible flag values are server dependent, but can include:
ExpungeMailbox ).
IMAPControl.MessageSet = "1"
IMAPControl.AddMessageFlags("\\Deleted")
IPWorksExceptionpublic java.lang.String getMessageFrom()
MessageFrom normally has 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.
public HeaderList getMessageHeaders()
This property holds the full headers of the message in RFC822 format.
The headers are retrieved by calling the FetchMessageHeaders method.
public void setMessageHeaders(HeaderList messageHeaders)
throws IPWorksException
This property holds the full headers of the message in RFC822 format.
The headers are retrieved by calling the FetchMessageHeaders method.
IPWorksExceptionpublic java.lang.String getMessageHeadersString()
This property holds the full headers of the message in
RFC822 format. The headers are retrieved by calling
the FetchMessageHeaders method.
public void setMessageHeadersString(java.lang.String messageHeadersString)
throws IPWorksException
This property holds the full headers of the message in
RFC822 format. The headers are retrieved by calling
the FetchMessageHeaders method.
IPWorksExceptionpublic java.lang.String getMessageId()
The bean fills out the MessageId property
when message information is retrieved from the MailServer .
The id is permanent if UIDMode is set, and temporary otherwise.
public MessageInfoList getMessageInfo()
FetchMessageInfo .
The MessageInfo property is populated when messages are searched, listed, or message information is received from the server. The collection contains a list of each message's MESSAGEINFO as returned by the server.
MessageInfoLimitcan be used to control the number of MESSAGEINFO s saved.
This collection is indexed from 0 to Count - 1.
public java.lang.String getMessageInReplyTo()
The bean 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.
public java.lang.String getMessageNetId()
The bean 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.
public MessagePartList getMessageParts()
FetchMessageInfo .
This collection of message parts is populated when you
call FetchMessageInfo . Once the message is received from
the server, the bean parses the different parts and
their corresponding information into the MESSAGEPARTS collection. Each MESSAGEPART contains a unique Id .
MaxMessagePartscan be used to control the number of message parts saved.
This collection is indexed from 0 to Count - 1.
public MessageRecipientList getMessageRecipients()
This collection describes all of the people to whom
the message was sent. Each MESSAGERECIPIENT contains
information describing that recipient, and what type
of recipient it is. This collection is populated when
the FetchMessageInfo method is called.
This collection is indexed from 0 to Count - 1.
public java.lang.String getMessageReplyTo()
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.
public java.lang.String getMessageSender()
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.
public java.lang.String getMessageSet()
Used as an argument to most method calls.
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").
Example (Setting MessageSet)
IMAPControl.MessageSet = "1"
IMAPControl.FetchMessageInfo()
IMAPControl.MessageSet = "1:5"
IMAPControl.FetchMessageInfo()
IMAPControl.MessageSet = "1,5,7"
IMAPControl.FetchMessageInfo()
public void setMessageSet(java.lang.String messageSet)
throws IPWorksException
Used as an argument to most method calls.
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").
Example (Setting MessageSet)
IMAPControl.MessageSet = "1"
IMAPControl.FetchMessageInfo()
IMAPControl.MessageSet = "1:5"
IMAPControl.FetchMessageInfo()
IMAPControl.MessageSet = "1,5,7"
IMAPControl.FetchMessageInfo()
IPWorksExceptionpublic int getMessageSize()
The bean fills out the MessageSize property
when message information is retrieved from the MailServer .
public java.lang.String getMessageSubject()
The bean fills out the MessageSubject property
when message information is retrieved from the MailServer .
public java.lang.String getMessageText()
The bean fills out MessageText with the contents of the message body
(in RFC822 format) when a call to FetchMessageText completes successfully.
public void setMessageText(java.lang.String messageText)
throws IPWorksException
The bean fills out MessageText with the contents of the message body
(in RFC822 format) when a call to FetchMessageText completes successfully.
IPWorksExceptionpublic java.lang.String getPassword()
MailServer .
Both the User and Password properties must be set
before connecting to the MailServer .
public void setPassword(java.lang.String password)
throws IPWorksException
MailServer .
Both the User and Password properties must be set
before connecting to the MailServer .
IPWorksExceptionpublic boolean isPeekMode()
When PeekMode is True, a "PEEK" option is added to all IMAP FETCH
commands sent to the server. An RFC compliant IMAP server should not
set the "Seen" flag on the message in this case.
public void setPeekMode(boolean peekMode)
throws IPWorksException
When PeekMode is True, a "PEEK" option is added to all IMAP FETCH
commands sent to the server. An RFC compliant IMAP server should not
set the "Seen" flag on the message in this case.
IPWorksExceptionpublic int getRecentMessageCount()
Mailbox .
The bean fills out MessageCount , RecentMessageCount ,
and MailboxFlags after connecting to the MailServer and selecting
or examining a Mailbox .
public java.lang.String getSortCriteria()
When set, the bean will send the SORT command to the server before any retrieval. If the server supports the SORT command, the results from the fetch operation will be sorted according to SortCriteria . The format of the SortCriteria property consists of a parenthesized list of one or more sort keys.
Example (Setting SortCriteria)
IMAPControl.SortCriteria = "DATE"
IMAPControl.SortCriteria = "SUBJECT FROM"
IMAPControl.SortCriteria = "REVERSE SUBJECT"
Possible sort keys include:
Please note that IMAP SORT functionality is relatively new and not all servers may implement it.
public void setSortCriteria(java.lang.String sortCriteria)
throws IPWorksException
When set, the bean will send the SORT command to the server before any retrieval. If the server supports the SORT command, the results from the fetch operation will be sorted according to SortCriteria . The format of the SortCriteria property consists of a parenthesized list of one or more sort keys.
Example (Setting SortCriteria)
IMAPControl.SortCriteria = "DATE"
IMAPControl.SortCriteria = "SUBJECT FROM"
IMAPControl.SortCriteria = "REVERSE SUBJECT"
Possible sort keys include:
Please note that IMAP SORT functionality is relatively new and not all servers may implement it.
IPWorksExceptionpublic int getStartByte()
StartByte and EndByte are used together with the FetchMessagePart method to specify the portion
of the message part to be retrieved from the server.
When StartByte or EndByte contain values other than the
defaults (0), only the corresponding portion of the message part
is retrieved from the server.
Byte indexes start from 1. The default value for EndByte is 0, which
corresponds to the end of the message.
public void setStartByte(int startByte)
throws IPWorksException
StartByte and EndByte are used together with the FetchMessagePart method to specify the portion
of the message part to be retrieved from the server.
When StartByte or EndByte contain values other than the
defaults (0), only the corresponding portion of the message part
is retrieved from the server.
Byte indexes start from 1. The default value for EndByte is 0, which
corresponds to the end of the message.
IPWorksExceptionpublic int getTimeout()
If the Timeout property is set to 0, all operations
will run uninterrupted until successful completion, or an error condition
is encountered.
If Timeout is set to a positive value, the bean will
wait for the operation to complete before returning control.
The bean will use DoEvents to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an IPWorksException
raises an IPWorksException exception
.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
data is successfully sent or received.
Optionally, the behaviour of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by theAbsoluteTimeoutconfiguration setting.
The default value for the Timeout property is 60 (seconds).
public void setTimeout(int timeout)
throws IPWorksException
If the Timeout property is set to 0, all operations
will run uninterrupted until successful completion, or an error condition
is encountered.
If Timeout is set to a positive value, the bean will
wait for the operation to complete before returning control.
The bean will use DoEvents to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an IPWorksException
raises an IPWorksException exception
.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
data is successfully sent or received.
Optionally, the behaviour of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by theAbsoluteTimeoutconfiguration setting.
The default value for the Timeout property is 60 (seconds).
IPWorksExceptionpublic boolean isUIDMode()
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 .
public void setUIDMode(boolean UIDMode)
throws IPWorksException
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 .
IPWorksExceptionpublic java.lang.String getUIDValidity()
SelectMailbox command.
Every time a mailbox is selected a UIDValidity is returned from the server.
Most of the time this value will not change from call to call. In case it does
change, it means that all previously returned UIDs for messages inside this
mailbox are now invalid.
public java.lang.String getUser()
MailServer .
Both the User and Password properties must be set
before connecting to the MailServer .
public void setUser(java.lang.String user)
throws IPWorksException
MailServer .
Both the User and Password properties must be set
before connecting to the MailServer .
IPWorksException
public void addMessageFlags(java.lang.String flags)
throws IPWorksException
MessageSet .
Add the specified flags to
the messages specified by the MessageSet property.
The format of the flags is specified by the IMAP RFCs.
Examples of possible flag values are server dependent, but can include:
ExpungeMailbox ).
IMAPControl.MessageSet = "1"
IMAPControl.AddMessageFlags("\\Deleted")
IPWorksException
public void appendToMailbox()
throws IPWorksException
MessageText to the mailbox specified by Mailbox .
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.
Example (Append Message to Mailbox)
IMAPControl.MessageText = MessageHeaders + CRLF + CRLF + MessageBody + CRLF
IMAPControl.Mailbox = "INBOX"
IMAPControl.MessageFlags = "\\Deleted"
IMAPControl.AppendToMailbox()
IPWorksException
public void checkMailbox()
throws IPWorksException
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.
IPWorksException
public void closeMailbox()
throws IPWorksException
Permanently remove all messages that have the 'Deleted' flag set from the current (selected) mailbox, and then close (deselect) the mailbox.
IPWorksException
public java.lang.String config(java.lang.String configurationString)
throws IPWorksException
Config is a generic method available in every bean.
It is used to set and retrieveconfiguration settingsfor the
bean.
Configuration settings are similar in functionality to properties,
but they are rarely used. In order to avoid "polluting" the property
namespace of the bean, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.
IPWorksException
public void connect()
throws IPWorksException
Connect to the IMAP server specified by MailServer and authenticate
using the user name and password supplied in the User and Password properties.
Example (Connect IMAP Server)
IMAPControl.MailServer = "myserver"
IMAPControl.Mailbox = "INBOX"
IMAPControl.User = "myusername"
IMAPControl.Password = "mypassword"
IMAPControl.Connect()
IMAPControl.MailServer = "myserver"
IMAPControl.Mailbox = "DOMAIN/USERNT/INBOX"
IMAPControl.User = "myusername"
IMAPControl.Password = "mypassword"
IMAPControl.Connect()
IPWorksException
public void copyToMailbox()
throws IPWorksException
MessageSet to the mailbox specified by Mailbox .
Copies the messages specified by the MessageSet property to
the mailbox specified by the Mailbox property.
IPWorksException
public void createMailbox()
throws IPWorksException
Mailbox .
Create a new mailbox. The mailbox name is specified by the Mailbox property.
IPWorksException
public void deleteFromMailbox()
throws IPWorksException
MessageSet as deleted.
Calling the DeleteFromMailbox method is equivalent to
calling AddMessageFlags with "\\Deleted" as the Flags parameter.
IPWorksException
public void deleteMailbox()
throws IPWorksException
Mailbox .
Delete a mailbox. The mailbox name is specified by the Mailbox property.
IPWorksException
public void deleteMailboxACL(java.lang.String user)
throws IPWorksException
Ask the server to remove all rights associated with User from the mailbox specified in the Mailbox property. Refer to SetMailboxACL and GetMailboxACL for more information on mailbox access rights.
IPWorksException
public void disconnect()
throws IPWorksException
Logout and disconnect from the IMAP server.
IPWorksException
public void doEvents()
throws IPWorksException
When DoEvents is called, the bean processes any
available events. If no events are available, it waits for a
preset period of time, and then returns.
IPWorksException
public void examineMailbox()
throws IPWorksException
Ask the server to select the mailbox specified in the Mailbox property
in read-only mode.
Example (Open a Mailbox in Read/Write Mode)
IMAPControl.Mailbox = "INBOX"
IMAPControl.SelectMailbox
Example (Open a Mailbox in Read-Only Mode)
IMAPControl.Mailbox = "INBOX.Folder"
IMAPControl.ExamineMailbox
IPWorksException
public void expungeMailbox()
throws IPWorksException
Permanently remove all messages that have the 'Deleted' flag set from the current (selected) mailbox. Example (Set "Deleted" flag and Expunge)
IMAPControl.MessageSet = "1"
IMAPControl.AddMessageFlags("\\Deleted")
IMAPControl.ExpungeMailbox()
IPWorksException
public void fetchMessageHeaders()
throws IPWorksException
MessageSet property.
Retrieves RFC822 headers of the message specified by MessageSet and stores them in the MessageHeaders property.
IPWorksException
public void fetchMessageInfo()
throws IPWorksException
MessageSet property.
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.
IPWorksException
public void fetchMessagePart(java.lang.String partId)
throws IPWorksException
Retrieves the contents of the 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.
The part id-s of each message part (if any) are provided through the corresponding MessagePart events.
IPWorksException
public void fetchMessageText()
throws IPWorksException
MessageSet property.
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.
IPWorksException
public void getMailboxACL()
throws IPWorksException
Mailbox rights are provided through one or more MailboxACL events.
IPWorksException
public void interrupt()
throws IPWorksException
If there is no method in progress, Interrupt simply returns doing nothing.
IPWorksException
public void listMailboxes()
throws IPWorksException
Mailbox property.
List all mailboxes matching the criteria in the Mailbox property. Matching mailboxes are returned through the MailboxList event.
Example (List All Mailboxes)
IMAPControl.Mailbox = "*"
IMAPControl.ListMailboxes()
Example (List All Mailboxes Inside INBOX)
IMAPControl.Mailbox = "INBOX.*"
IMAPControl.ListMailboxes()
IPWorksException
public void listSubscribedMailboxes()
throws IPWorksException
Mailbox property.
List all subscribed mailboxes matching the criteria in
the Mailbox property. Matching mailboxes are returned through MailboxList event.
Example (List All Subscribed Mailboxes)
IMAPControl.Mailbox = "*"
IMAPControl.ListSubscribedMailboxes()
Example (List All Subscribed Mailboxes Inside INBOX)
IMAPControl.Mailbox = "INBOX.*"
IMAPControl.ListSubscribedMailboxes()
IPWorksException
public java.lang.String localizeDate(java.lang.String dateTime)
throws IPWorksException
This method can be used to convert an RFC 822 date/time string to the corresponding local date and time.
Dates will be returned in the format: "MM/dd/yyyy hh:mm:ss".
IPWorksException
public void moveToMailbox()
throws IPWorksException
MessageSet to the mailbox specified by Mailbox .
Moves the messages specified by the MessageSet property to
the mailbox specified by the Mailbox property.
IPWorksException
public void noop()
throws IPWorksException
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).
IPWorksException
public void renameMailbox(java.lang.String newName)
throws IPWorksException
Mailbox to NewName .
Rename a mailbox. The mailbox is specified by the Mailbox property,
and the new name is specified by the NewName parameter.
IPWorksException
public void resetMessageFlags()
throws IPWorksException
MessageSet with the flags specified by MessageFlags .
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.
Examples of possible flag values are server dependent, but can include:
ExpungeMailbox ).
IPWorksException
public void searchMailbox(java.lang.String searchCriteria)
throws IPWorksException
Search the selected mailbox using the criteria specified in the SearchCriteria parameter. For every message matching the criteria, the FetchMessageInfo method is called and a MessageInfo event is fired.
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:
IPWorksException
public void selectMailbox()
throws IPWorksException
Ask the server to select the mailbox specified in the Mailbox property.
The mailbox is selected in read/write mode (if the server permits).
Example (Open a Mailbox in Read/Write Mode)
IMAPControl.Mailbox = "INBOX"
IMAPControl.SelectMailbox
Example (Open a Mailbox in Read-Only Mode)
IMAPControl.Mailbox = "INBOX.Folder"
IMAPControl.ExamineMailbox
IPWorksException
public void setMailboxACL(java.lang.String user,
java.lang.String rights)
throws IPWorksException
Changes the access control list for the mailbox specified in the Mailbox property so that User is granted the permissions specified in Rights .
Rights is a string containing an optional plus ("+") or minus ("-") prefix, followed by zero or more rights characters. If the string starts with a plus, the rights are added to any existing rights for the identifier. If the string starts with a minus, the rights are removed from any existing rights for the identifier. If the string does not start with a plus or minus, the rights replace any existing rights for the identifier.
Standard rights include:
IPWorksException
public void setMessageStream(java.io.OutputStream messageStream)
throws IPWorksException
If a download stream is set before the Retrieve method is called, the downloaded data will be written to the stream. The stream should be open and normally set to position 0.
The bean will automatically close this stream ifCloseStreamAfterTransferis true (default). If the stream is closed, you will need to call SetMessageStream again before calling Retrieve again.
The downloaded content will be written starting at the current position in the stream.
Note: SetMessageStream and LocalFile will reset the other.
IPWorksException
public void subscribeMailbox()
throws IPWorksException
Mailbox .
Subscribe to the mailbox specified by the Mailbox property.
IPWorksException
public void unsetMessageFlags()
throws IPWorksException
MessageFlags from the messages specified by MessageSet .
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.
Examples of possible flag values are server dependent, but can include:
ExpungeMailbox ).
IPWorksException
public void unsubscribeMailbox()
throws IPWorksException
Mailbox .
Unsubscribe from the mailbox specified by the Mailbox property.
IPWorksException
public void addImapEventListener(ipworks.ImapEventListener l)
throws java.util.TooManyListenersException
java.util.TooManyListenersExceptionpublic void removeImapEventListener(ipworks.ImapEventListener l)
|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||