IP*Works! V9

ipworks
Class Pop

java.lang.Object
  extended by ipworks.Pop

public class Pop
extends java.lang.Object

The POP Bean is used retrieve electronic mail from Internet Post Office servers (POP).

The POP Bean implements a standard internet post office (POP3) client as specified in RFC 1725.

To connect to a MailServer first set the appropriate User and Password and then connect by calling the Connect method. Upon successful connection to the MailServer , the number of waiting messages is shown by the MessageCount property. A message is selected by setting the MessageNumber property to a number between 1 and MessageCount (inclusive). Then, message text and/or headers are received by calling the Retrieve method.

The message text is received through the Transfer event, whereas the message headers are received through the Header event. Additionally, up to MaxLines from the message body are provided in the MessageText property. The body of the message is also saved in the file specified by the LocalFile property. StartTransfer and EndTransfer events are fired at the beginning and end of message transmission. The PITrail event provides a trace of the interaction between the client and server (excluding message transfers).


Field Summary
static int amAPOP
           
static int amCRAMMD5
           
static int amKerberos
           
static int amNTLM
           
static int amSASLDigestMD5
           
static int amSASLPlain
           
static int amUserPassword
           
 
Constructor Summary
Pop()
          Creates an instance of Pop Bean.
Pop(java.lang.String runtimeLicense)
          Creates an instance of Pop Bean with specified run-time license.
 
Method Summary
 void addPopEventListener(PopEventListener l)
           
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a configuration setting.
 void connect()
          Connects to the mail server and attempts to login.
 void delete()
          Deletes a message specified by MessageNumber on the server.
 void disconnect()
          Disconnects from the mail server.
 void doEvents()
          Processes events from the internal message queue.
 int getAuthMechanism()
          The authentication mechanism to be used when connecting to the mail server.
 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.
 int getMailPort()
          The server port for POP (default 110).
 java.lang.String getMailServer()
          The name or address of a mail server (internet post office server).
 int getMaxLines()
          The maximum number of message lines besides headers to retrieve.
 byte[] getMessage()
          Provides the raw message content.
 java.lang.String getMessageCc()
          The value of the CC header of the last retrieved message.
 int getMessageCount()
          The number of messages waiting in the mailbox.
 java.lang.String getMessageDate()
          The value of the date header of the last retrieved message.
 java.lang.String getMessageFrom()
          The value of the from header of the last retrieved message.
 HeaderList getMessageHeaders()
          Collection of the message headers as retrieved from the server.
 java.lang.String getMessageHeadersString()
          A string representation of the full headers of the message as retrieved from the server.
 int getMessageNumber()
          Current (selected) message.
 MessageRecipientList getMessageRecipients()
          A collection of recipients for the current message.
 java.lang.String getMessageReplyTo()
          The value of the Reply-To header of the last retrieved message.
 int getMessageSize()
          The size in bytes of the current message.
 java.lang.String getMessageSubject()
          The value of the Subject header of the last retrieved message.
 java.lang.String getMessageText()
          The full text of the message as retrieved from the server.
 java.lang.String getMessageTo()
          The value of the To header of the last retrieved message.
 java.lang.String getMessageUID()
          The unique identifier of the message as specified by the server.
 java.lang.String getPassword()
          The password for the mailbox user.
 int getTimeout()
          A timeout for the bean.
 long getTotalSize()
          Cumulative size in bytes of messages in the mailbox (including headers).
 java.lang.String getUser()
          The user identifier for the mailbox.
 void interrupt()
          Interrupt the current method.
 boolean isConnected()
          Shows whether the bean is connected.
 boolean isIdle()
          The current status of the component.
 boolean isIncludeHeaders()
          Instructs the component to include the headers in the MessageText and LocalFile.
 void listMessageSizes()
          Retrieves a list of all message sizes from the server.
 void listMessageUIDs()
          Retrieves a list of all message UIDs from the server.
 java.lang.String localizeDate(java.lang.String dateTime)
          Converts a valid RFC 822 message date to local date and time.
 void removePopEventListener(PopEventListener l)
           
 void reset()
          Resets all changes and revert back to the state when the user first connected.
 void retrieve()
          Retrieves a message specified by MessageNumber from the server.
 void retrieveHeaders()
          Retrieves headers for a message specified by MessageNumber .
 void setAuthMechanism(int authMechanism)
          The authentication mechanism to be used when connecting to the mail server.
 void setCommand(java.lang.String command)
          Used to send additional commands directly to the server.
 void setConnected(boolean connected)
          Shows whether the bean is connected.
 void setFirewall(Firewall firewall)
          A set of properties related to firewall access.
 void setIncludeHeaders(boolean includeHeaders)
          Instructs the component to include the headers in the MessageText and LocalFile.
 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 setMailPort(int mailPort)
          The server port for POP (default 110).
 void setMailServer(java.lang.String mailServer)
          The name or address of a mail server (internet post office server).
 void setMaxLines(int maxLines)
          The maximum number of message lines besides headers to retrieve.
 void setMessageNumber(int messageNumber)
          Current (selected) message.
 void setMessageStream(java.io.OutputStream messageStream)
          Sets the stream to which the message downloaded from the server will be written.
 void setPassword(java.lang.String password)
          The password for the mailbox user.
 void setTimeout(int timeout)
          A timeout for the bean.
 void setUser(java.lang.String user)
          The user identifier for the mailbox.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

amUserPassword

public static final int amUserPassword
See Also:
Constant Field Values

amCRAMMD5

public static final int amCRAMMD5
See Also:
Constant Field Values

amNTLM

public static final int amNTLM
See Also:
Constant Field Values

amAPOP

public static final int amAPOP
See Also:
Constant Field Values

amSASLPlain

public static final int amSASLPlain
See Also:
Constant Field Values

amSASLDigestMD5

public static final int amSASLDigestMD5
See Also:
Constant Field Values

amKerberos

public static final int amKerberos
See Also:
Constant Field Values
Constructor Detail

Pop

public Pop()
Creates an instance of Pop Bean.


Pop

public Pop(java.lang.String runtimeLicense)
Creates an instance of Pop Bean with specified run-time license.

Method Detail

getAuthMechanism

public int getAuthMechanism()
The authentication mechanism to be used when connecting to the mail server.

This property is used as the authentication mechanism when connecting to the mail server. By default, this property is amUserPassword (0), and default plaintext authentication is used to login to the server. Other, more secure, options include amCRAMMD5 (1) for CRAM-MD5, amNTLM (2) for NTLM authentication, amAPOP (3) for APOP authentication, and amSASLDigestMD5 (5) for SASL DIGEST-MD5 authentication.

amSASLPlain (4) is also available, but most servers require a secure SSL connection when utilizing this authentication mechanism.

amKerberos (6) is for Kerberos authentication. NOTE: This functionality is only available in Windows.


setAuthMechanism

public void setAuthMechanism(int authMechanism)
                      throws IPWorksException
The authentication mechanism to be used when connecting to the mail server.

This property is used as the authentication mechanism when connecting to the mail server. By default, this property is amUserPassword (0), and default plaintext authentication is used to login to the server. Other, more secure, options include amCRAMMD5 (1) for CRAM-MD5, amNTLM (2) for NTLM authentication, amAPOP (3) for APOP authentication, and amSASLDigestMD5 (5) for SASL DIGEST-MD5 authentication.

amSASLPlain (4) is also available, but most servers require a secure SSL connection when utilizing this authentication mechanism.

amKerberos (6) is for Kerberos authentication. NOTE: This functionality is only available in Windows.

Throws:
IPWorksException

setCommand

public void setCommand(java.lang.String command)
                throws IPWorksException
Used to send additional commands directly to the server.

This property can be used to send additional commands directly to the server. Check the LastReply property and/or trap the PITrail events coming from the server to get the response.

Throws:
IPWorksException

isConnected

public boolean isConnected()
Shows whether the bean is connected.

This property is used to determine whether or not the bean is connected to the remote host.


setConnected

public void setConnected(boolean connected)
                  throws IPWorksException
Shows whether the bean is connected.

This property is used to determine whether or not the bean is connected to the remote host.

Throws:
IPWorksException

getFirewall

public Firewall getFirewall()
A set of properties related to firewall access.

This is a Firewall type property which contains fields describing the firewall through which the bean will attempt to connect.


setFirewall

public void setFirewall(Firewall firewall)
                 throws IPWorksException
A set of properties related to firewall access.

This is a Firewall type property which contains fields describing the firewall through which the bean will attempt to connect.

Throws:
IPWorksException

isIdle

public boolean isIdle()
The current status of the component.

Idle will be False if the component is currently busy (communicating and/or waiting for an answer), and True at all other times.


isIncludeHeaders

public boolean isIncludeHeaders()
Instructs the component to include the headers in the MessageText and LocalFile.

This property instructs the component to include the headers in the MessageText and LocalFile. If set to true, the headers for the message you are retrieving will be placed before the message body in the MessageText property;. If LocalFile is set, then the headers will be written to that file before the message body. In this manner, the whole content of a MIME-encoded message can be passed to the MIME bean for further message processing.


setIncludeHeaders

public void setIncludeHeaders(boolean includeHeaders)
                       throws IPWorksException
Instructs the component to include the headers in the MessageText and LocalFile.

This property instructs the component to include the headers in the MessageText and LocalFile. If set to true, the headers for the message you are retrieving will be placed before the message body in the MessageText property;. If LocalFile is set, then the headers will be written to that file before the message body. In this manner, the whole content of a MIME-encoded message can be passed to the MIME bean for further message processing.

Throws:
IPWorksException

getLastReply

public java.lang.String getLastReply()
The last reply from the server.

This property indicates the last reply received from the server. It can be used for informational purposes. The same information and more can also 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).

This property is used when retrieving a message. If this property 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).

This property is used when retrieving a message. If this property is empty then the received data is provided through the parameters of the Transfer event.

Throws:
IPWorksException

getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

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 multi-homed 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 multi-homed 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.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

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 multi-homed 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 multi-homed 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.

Throws:
IPWorksException

getMailPort

public int getMailPort()
The server port for POP (default 110).

This property contains the server port for POP (default 110). 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.


setMailPort

public void setMailPort(int mailPort)
                 throws IPWorksException
The server port for POP (default 110).

This property contains the server port for POP (default 110). 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.

Throws:
IPWorksException

getMailServer

public java.lang.String getMailServer()
The name or address of a mail server (internet post office server).

This property specifies the IP address (IP number in dotted internet format) or the 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 this; property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, this property is set to the corresponding address. If the search is not successful the bean throws an exception.

If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with an "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.


setMailServer

public void setMailServer(java.lang.String mailServer)
                   throws IPWorksException
The name or address of a mail server (internet post office server).

This property specifies the IP address (IP number in dotted internet format) or the 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 this; property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, this property is set to the corresponding address. If the search is not successful the bean throws an exception.

If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with an "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.

Throws:
IPWorksException

getMaxLines

public int getMaxLines()
The maximum number of message lines besides headers to retrieve.

This property is used to limit the number of text lines besides headers retrieved for messages. It can be used to preview message headers and a portion of their contents, without incurring the overhead of downloading the entire message.

The default value of the property is 0. In this case the entire message will be retrieved, without interruptions.


setMaxLines

public void setMaxLines(int maxLines)
                 throws IPWorksException
The maximum number of message lines besides headers to retrieve.

This property is used to limit the number of text lines besides headers retrieved for messages. It can be used to preview message headers and a portion of their contents, without incurring the overhead of downloading the entire message.

The default value of the property is 0. In this case the entire message will be retrieved, without interruptions.

Throws:
IPWorksException

getMessage

public byte[] getMessage()
Provides the raw message content.

This property is populated after calling Retrieve and holds the raw message content. This can be used to access the data before any processing is done by the bean.


getMessageCc

public java.lang.String getMessageCc()
The value of the CC header of the last retrieved message.

This property contains the value of the CC header of the last retrieved message. The same information may also be retrieved through the Header event.


getMessageCount

public int getMessageCount()
The number of messages waiting in the mailbox.

This property contains the number of messages waiting in the mailbox. When the bean is not connected to the server, the value of this property is 0. When connected, it contains the number of messages in the mail box as reported by the POP server.


getMessageDate

public java.lang.String getMessageDate()
The value of the date header of the last retrieved message.

This property contains the value of the date header of the last retrieved message. The same information may also be retrieved through the Header event.


getMessageFrom

public java.lang.String getMessageFrom()
The value of the from header of the last retrieved message.

This property contains the value of the from header of the last retrieved message. The same information may also be retrieved through the Header event.


getMessageHeaders

public HeaderList getMessageHeaders()
Collection of the message headers as retrieved from the server.

This property contains a collection of the message headers as retrieved from the server. If the bean is not connected, or MessageNumber does not contain a valid message number, the value of this property is an empty collection. Otherwise, it contains a parsed collection of the full headers of the mail message as reported by the server.

The MailServer is asked about the headers of the message only if the MessageNumber property has changed. If MessageNumber has not changed, the bean returns a cached value.

Example (Connect and Retrieve Message)

 POPControl.MailServer = "MyPOPServer"
 POPControl.User = "username"
 POPControl.Password = "password"
 POPControl.Connect()
 
 POPControl.MessageNumber = 1
 MessageText = POPControl.MessageText
 MessageHeaders = POPControl.MessageHeaders 


getMessageHeadersString

public java.lang.String getMessageHeadersString()
A string representation of the full headers of the message as retrieved from the server.

This property contains a string representation of the full headers of the message as retrieved from the server. If the bean is not connected, or MessageNumber does not contain a valid message number, the value of this property is an empty string. Otherwise, it contains the full headers of the mail message as reported by the server.

The MailServer is asked about the headers of the message only if the MessageNumber property has changed. If MessageNumber has not changed, the bean returns a cached value.

Example (Connect and Retrieve Message)

 POPControl.MailServer = "MyPOPServer"
 POPControl.User = "username"
 POPControl.Password = "password"
 POPControl.Connect()
 
 POPControl.MessageNumber = 1
 MessageText = POPControl.MessageText
 MessageHeadersString = POPControl.MessageHeadersString 


getMessageNumber

public int getMessageNumber()
Current (selected) message.

This property indicates the current/selected message. This property specifies a message number in between 1 and MessageCount . The various bean methods related to single messages use this property as a message pointer (see method descriptions and the MessageSize property).


setMessageNumber

public void setMessageNumber(int messageNumber)
                      throws IPWorksException
Current (selected) message.

This property indicates the current/selected message. This property specifies a message number in between 1 and MessageCount . The various bean methods related to single messages use this property as a message pointer (see method descriptions and the MessageSize property).

Throws:
IPWorksException

getMessageRecipients

public MessageRecipientList getMessageRecipients()
A collection of recipients for the current message.

This property contains a collection of recipients for the current message. This collection describes all of the people to whom the last retrieved message was sent. Each messagerecipient contains information describing that recipient, and what type of recipient it is.

This collection is indexed from 0 to size - 1.


getMessageReplyTo

public java.lang.String getMessageReplyTo()
The value of the Reply-To header of the last retrieved message.

This property contains the value of the Reply-To header of the last retrieved message. The same information may also be retrieved through the Header event.


getMessageSize

public int getMessageSize()
The size in bytes of the current message.

This property contains the size in bytes of the current message. If the bean is not connected, or MessageNumber does not contain a valid message number, the value of this property is 0. Otherwise, it contains the size of the mail message (including headers) as reported by the server.

The MailServer is asked about the size of the message only if the MessageNumber property has changed. If MessageNumber has not changed, the bean returns a cached value.


getMessageSubject

public java.lang.String getMessageSubject()
The value of the Subject header of the last retrieved message.

This property contains the value of the Subject header of the last retrieved message. The same information may also be retrieved through the Header event.


getMessageText

public java.lang.String getMessageText()
The full text of the message as retrieved from the server.

This property contains the full text of the message as retrieved from the server. If the bean is not connected, or MessageNumber does not contain a valid message number, the value of this property is an empty string. Otherwise, it contains the text of the mail message as reported by the server (a maximum of MaxLines ).

The MailServer is asked about the text of the message only if the MessageNumber property has changed. If MessageNumber has not changed, the bean returns a cached value.

Example (Connect and Retrieve Message)

 POPControl.MailServer = "MyPOPServer"
 POPControl.User = "username"
 POPControl.Password = "password"
 POPControl.Connect()
 
 POPControl.MessageNumber = 1
 MessageText = POPControl.MessageText
 MessageHeaders = POPControl.MessageHeaders 


getMessageTo

public java.lang.String getMessageTo()
The value of the To header of the last retrieved message.

This property contains the value of the To header of the last retrieved message. The same information may also be retrieved through the Header event.


getMessageUID

public java.lang.String getMessageUID()
The unique identifier of the message as specified by the server.

This property contains the unique identifier of the message as specified by the server. If the bean is not connected, or MessageNumber does not contain a valid message number, the value of this property is an empty string. Otherwise, it contains the UID of the mail message as reported by the server.

The MailServer is asked about the UID of the message only if the MessageNumber property has changed. If MessageNumber has not changed, the bean returns a cached value.


getPassword

public java.lang.String getPassword()
The password for the mailbox user.

This property contains the password for the mailbox user. This property must be set before the bean connects to the MailServer .


setPassword

public void setPassword(java.lang.String password)
                 throws IPWorksException
The password for the mailbox user.

This property contains the password for the mailbox user. This property must be set before the bean connects to the MailServer .

Throws:
IPWorksException

getTimeout

public int getTimeout()
A timeout for the bean.

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 exception.

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when any amount of data is successfully sent or received.

Optionally, the behavior 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 the AbsoluteTimeout configuration setting.

The default value for the Timeout property is 60 (seconds).


setTimeout

public void setTimeout(int timeout)
                throws IPWorksException
A timeout for the bean.

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 exception.

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when any amount of data is successfully sent or received.

Optionally, the behavior 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 the AbsoluteTimeout configuration setting.

The default value for the Timeout property is 60 (seconds).

Throws:
IPWorksException

getTotalSize

public long getTotalSize()
Cumulative size in bytes of messages in the mailbox (including headers).

This property contains the cumulative size in bytes of messages in the mailbox (including headers). When the bean is not connected to the server, the value of this property is 0. When connected, it contains the cumulative size of all the messages in the mail box as reported by the POP server.


getUser

public java.lang.String getUser()
The user identifier for the mailbox.

This property contains the user identifier for the mailbox. This property must be set before the bean connects to the MailServer .


setUser

public void setUser(java.lang.String user)
             throws IPWorksException
The user identifier for the mailbox.

This property contains the user identifier for the mailbox. This property must be set before the bean connects to the MailServer .

Throws:
IPWorksException

config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksException
Sets or retrieves a configuration setting.

Config is a generic method available in every bean. It is used to set and retrieve configuration settings for 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.

The bean accepts one or more of the following configuration settings . 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.

POP Configuration Settings

AuthorizationIdentity
The value to use as the authorization identity when SASL authentication is used
When AuthMechanism is set to amSASLPlain or amSASLDigestMD5 you may use this setting to specify an authorization identity to be used when authenticating.
GetMessageSize
Whether to poll the server for the message size prior to retrieving it
By default this value is False. When set to true, the bean will retrieve the message size from the server before downloading it and the PercentDone parameter of the Transfer event will be populated. When this value is False (default), the PercentDone parameter of the Transfer event will not be updated and will evaluate to -1.
IncludeHeaders
Whether to include message headers in the
If set to true, the LocalFile will include the message headers in addition to the message body.
MaxHeaders
Instructs bean to save the amount of headers specified that are returned by the server after a Header event has been fired
This config should be set when the MessageHeaders collection will be populated when a Header event has been fired. This value represents the number of headers that are to be saved in the collection .To save all items to the collection , set this config to -1. If no items are wanted, set this to 0, which will not save any to the collection . The default for this config is -1, so all items will be included in the collection .

NOTE: This functionality is only available in Java and .NET.

MaxLineLength
The maximum expected length for message lines
Normally, internet mail message lines are up to 80 bytes long, however, different mail systems might use other values. Change the value of this property if you are expecting longer lines.

IPPort Configuration Settings

FirewallAutoDetect
Tells the bean whether or not to automatically detect and use firewall system settings, if available
This is the same as AutoDetect . This setting is provided for use by beans that do not directly expose Firewall properties.
FirewallHost
Name or IP address of firewall (optional)
If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.If the FirewallHost setting is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, the FirewallHost setting is set to the corresponding address. If the search is not successful, an error is returned.

NOTE: This is the same as Host . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallListener
If true, the component binds to a SOCKS firewall as a server (IPPort only)
This entry is for IPPort only and does not work for other components that descend from IPPort.If this entry is set, the bean acts as a server. RemoteHost and RemotePort are used to tell the SOCKS firewall in which address and port to listen to. The firewall rules may ignore RemoteHost , and it is recommended that RemoteHost be set to empty string in this case.

RemotePort is the port in which the firewall will listen to. If set to 0, the firewall will select a random port. The binding (address and port) is provided through the ConnectionStatus event.

The connection to the firewall is made by calling the Connect method.

FirewallPassword
Password to be used if authentication is to be used when connecting through the firewall
If FirewallHost is specified, the FirewallUser and FirewallPassword settings are used to connect and authenticate to the given firewall. If the authentication fails, the bean throws an exception.NOTE: This is the same as Password . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallPort
The TCP port for the FirewallHost;
Note that the FirewallPort is set automatically when FirewallType is set to a valid value.NOTE: This is the same as Port . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallType
Determines the type of firewall to connect through
The appropriate values are as follows:
0
No firewall (default setting).
1
Connect through a tunneling proxy. FirewallPort is set to 80.
2
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
3
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.
NOTE: This is the same as FirewallType . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallUser
A user name if authentication is to be used connecting through a firewall
If the FirewallHost is specified, the FirewallUser and FirewallPassword settings are used to connect and authenticate to the Firewall. If the authentication fails, the bean throws an exception.NOTE: This is the same as User . This setting is provided for use by beans that do not directly expose Firewall properties.

KeepAliveTime
The inactivity time in milliseconds before a TCP keep-alive packet is sent
When set, TCPKeepAlive will automatically be set to true. By default the operating system will determine the time a connection is idle before a TCP keep-alive packet is sent. This system default if this value is not specified here is 2 hours. In many cases a shorter interval is more useful. Set this value to the desired interval in milliseconds.Note: This value is not applicable in Java.

KeepAliveInterval
The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received
When set, TCPKeepAlive will automatically be set to true. A TCP keep-alive packet will be sent after a period of inactivity as defined by KeepAliveTime . If no acknowledgement is received from the remote host the keep-alive packet will be re-sent. This setting specifies the interval at which the successive keep-alive packets are sent in milliseconds. This system default if this value is not specified here is 1 second.Note: This value is not applicable in Java or MAC.

Linger
When set to True, connections are terminated gracefully
This property controls how a connection is closed. The default is True.In the case that Linger is True (default), there are two scenarios for determining how long the connection will linger. The first, if LingerTime is 0 (default), the system will attempt to send pending data for a connection until the default IP protocol timeout expires.

In the second scenario, LingerTime is a positive value, the system will attempt to send pending data until the specified LingerTime is reached. If this attempt fails, then the system will reset the connection.

The default behavior (which is also the default mode for stream sockets) might result in a long delay in closing the connection. Although the bean returns control immediately, the system could hold system resources until all pending data is sent (even after your application closes).

Setting this property to False forces an immediate disconnection. If you know that the other side has received all the data you sent (by a client acknowledgment, for example), setting this property to False might be the appropriate course of action.

LingerTime
Time in seconds to have the connection linger
LingerTime is the time, in seconds, to leave the socket connection linger. This value is 0 by default, which means it will use the default IP protocol timeout.
LocalHost
The name of the local host through which connections are initiated or accepted
The LocalHost setting 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 multi-homed 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 setting 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 multi-homed hosts (machines with more than one IP interface).

LocalPort
The TCP port in the local host where the bean binds
This must be set before a connection is attempted. It instructs the bean to bind to a specific port (or communication endpoint) in the local machine.Setting this to 0 (default) enables the system to choose a port at random. The chosen port will be shown by LocalPort after the connection is established.

LocalPort cannot be changed once a connection is made. Any attempt to set this when a connection is active will generate an error.

This; setting is useful when trying to connect to services that require a trusted port in the client side. An example is the remote shell (rsh) service in UNIX systems.

MaxLineLength
The maximum amount of data to accumulate when no EOL is found
MaxLineLength is the size of an internal buffer, which holds received data while waiting for an EOL string.If an EOL string is found in the input stream before MaxLineLength bytes are received, the DataIn event is fired with the EOL parameter set to True, and the buffer is reset.

If no EOL is found, and MaxLineLength bytes are accumulated in the buffer, the DataIn event is fired with the EOL parameter set to False, and the buffer is reset.

The minimum value for MaxLineLength is 256 bytes. The default value is 2048 bytes. The maximum value is 65536 bytes.

MaxTransferRate
The transfer rate limit in bytes per second
This setting can be used to throttle outbound TCP traffic. Set this to the number of bytes to be sent per second. By default this is not set and there is no limit.
TCPKeepAlive
Determines whether or not the keep alive socket option is enabled
If set to true, the socket's keep-alive option is enabled and keep-alive packets will be sent periodically to maintain the connection. Set KeepAliveTime and KeepAliveInterval to configure the timing of the keep-alive packets.Note: This value is not applicable in Java.

UseIPv6
Whether or not to use IPv6
By default, the component expects an IPv4 address for local and remote host properties, and will create an IPv4 socket. To use IPv6 instead, set this to True.
CloseStreamAfterTransfer
If true, the component will close the upload or download stream after the transfer
This entry is for bean and all the components that descend from it.This property is true by default. Therefore, by default, all streams will be closed after a transfer is completed. In order to keep streams open after the transfer of data, you must set this config to false.

TcpNoDelay
Whether or not to delay when sending packets
When true, the socket will send all data that is ready to send at once. When false, the socket will send smaller buffered packets of data at small intervals. This is known as the Nagle algorithm.By default, this config is set to false.

Socket Configuration Settings

AbsoluteTimeout
Determines whether timeouts are inactivity timeouts or absolute timeouts
If AbsoluteTimeout is set to True, any method which does not complete within Timeout seconds will be aborted. By default, AbsoluteTimeout is False, and the timeout is an inactivity timeout.
FirewallData
Used to send extra data to the firewall
When the firewall is a tunneling proxy, use this property to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).
InBufferSize
The size in bytes of the incoming queue of the socket
This is the size of an internal queue in the TCP/IP stack. You can increase or decrease its size depending on the amount of data that you will be receiving. Increasing the value of the InBufferSize setting can provide significant improvements in performance in some cases.Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the bean is activated the InBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.

OutBufferSize
The size in bytes of the outgoing queue of the socket
This is the size of an internal queue in the TCP/IP stack. You can increase or decrease its size depending on the amount of data that you will be sending. Increasing the value of the OutBufferSize setting can provide significant improvements in performance in some cases.Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the bean is activated the OutBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.

Base Configuration Settings

GUIAvailable
Tells the bean whether or not a message loop is available for processing events
In a GUI-based application, long-running blocking operations may cause the application to stop responding to input until the operation returns. The bean will attempt to discover whether or not the application has a message loop and, if one is discovered, it will process events in that message loop during any such blocking operation.In some non-GUI applications an invalid message loop may be discovered that will result in errant behavior. In these cases, setting GuiAvailable to false will ensure that the bean does not attempt to process external events.

Throws:
IPWorksException

connect

public void connect()
             throws IPWorksException
Connects to the mail server and attempts to login.

This method connects to the mail server and attempts to login using the current User and Password . Then it retrieves initial statistics about the mailbox contents ( MessageCount and TotalSize ).

Example (Connect to POP Mailbox)

 POPControl.MailServer = "MyPOPServer"
 POPControl.User = "username"
 POPControl.Password = "password"
 POPControl.Connect()
 
 POPControl.MessageNumber = 1
 POPControl.Retrieve()
 MessageText = POPControl.MessageText
 MessageHeaders = POPControl.MessageHeaders 

Throws:
IPWorksException

delete

public void delete()
            throws IPWorksException
Deletes a message specified by MessageNumber on the server.

This method asks the MailServer to delete the message specified by MessageNumber . The message will not actually be deleted from the server until the connection is closed. In order to cancel a previous Delete, use the Reset method.

Throws:
IPWorksException

disconnect

public void disconnect()
                throws IPWorksException
Disconnects from the mail server.

This method makes the bean disconnect from the MailServer by sending the QUIT command. If successful, all changes to the mailbox are committed by the server. Otherwise, changes are rolled back to the initial state that the server was in before the connection.

Throws:
IPWorksException

doEvents

public void doEvents()
              throws IPWorksException
Processes events from the internal message queue.

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.

Throws:
IPWorksException

interrupt

public void interrupt()
               throws IPWorksException
Interrupt the current method.

If there is no method in progress, Interrupt simply returns, doing nothing.

Throws:
IPWorksException

listMessageSizes

public void listMessageSizes()
                      throws IPWorksException
Retrieves a list of all message sizes from the server.

This message retrieves a list of all message sizes from the server. For each message listed, a MessageList event will fire containing the number and size of the message.

Throws:
IPWorksException

listMessageUIDs

public void listMessageUIDs()
                     throws IPWorksException
Retrieves a list of all message UIDs from the server.

This method retrieves a list of all message UIDs from the server. For each message listed, a MessageList event will fire containing the number and UID of the message.

Throws:
IPWorksException

localizeDate

public java.lang.String localizeDate(java.lang.String dateTime)
                              throws IPWorksException
Converts a valid RFC 822 message date to local date and time.

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".

Throws:
IPWorksException

reset

public void reset()
           throws IPWorksException
Resets all changes and revert back to the state when the user first connected.

This method is used to reset all changes and revert back to the state when the user first connected. Asks the MailServer to reset all changes and revert back to the state it was when connected.

Throws:
IPWorksException

retrieve

public void retrieve()
              throws IPWorksException
Retrieves a message specified by MessageNumber from the server.

This method is used to retrieve a message specified by MessageNumber from the server. It asks the MailServer to retrieve the message specified by MessageNumber . The message headers will arrive in the Header event, and the message text will arrive in the Transfer event.

The MaxLines property defines the number of lines retrieved.

Example (Connect and Retrieve Message)

 POPControl.MailServer = "MyPOPServer"
 POPControl.User = "username"
 POPControl.Password = "password"
 POPControl.Connect()
 
 POPControl.MessageNumber = 1
 POPControl.Retrieve() 

Throws:
IPWorksException

retrieveHeaders

public void retrieveHeaders()
                     throws IPWorksException
Retrieves headers for a message specified by MessageNumber .

Calling this method will retrieve the headers for the message specified by the MessageNumber property. The message headers will be provided by the Header event and also stored in the MessageHeaders property.

Example (Connect and Retrieve Message Headers)

 POPControl.MailServer = "MyPOPServer"
 POPControl.User = "username"
 POPControl.Password = "password"
 POPControl.Connect()
 
 POPControl.MessageNumber = 1
 POPControl.RetrieveHeaders() 

Throws:
IPWorksException

setMessageStream

public void setMessageStream(java.io.OutputStream messageStream)
                      throws IPWorksException
Sets the stream to which the message downloaded from the server will be written.

This method sets the stream to which the message downloaded from the server will be written. 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 if CloseStreamAfterTransfer is set to 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.

Throws:
IPWorksException

addPopEventListener

public void addPopEventListener(PopEventListener l)
                         throws java.util.TooManyListenersException
Throws:
java.util.TooManyListenersException

removePopEventListener

public void removePopEventListener(PopEventListener l)

IP*Works! V9

Copyright (c) 2013 /n software inc. - All rights reserved.