Compoze Software, Inc.

com.compoze.mail
Interface ISession

All Known Implementing Classes:
AbstractSession

public interface ISession

This class defines a session to an Internet Mail server, and is the entry point into the Mail API. Use the SessionFactory to create a connection to a mail server.

 Properties connProps = new Properties();
 connProps.setProperty(ISession.CONNPROP_OUTGOING_HOST, "smtp.mycompany.com");
 connProps.setProperty(ISession.CONNPROP_INCOMING_HOST, "imap.mycompany.com");
 connProps.setProperty(ISession.CONNPROP_PROTOCOL, "imap-smtp");
 connProps.setProperty(ISession.CONNPROP_USER, "joe.smith");
 connProps.setProperty(ISession.CONNPROP_PASSWORD, "welcome");
 connProps.setProperty(ISession.CONNPROP_FROM, "joe.smith@mycompany.com");

 ISession s = SessionFactory.getSession(connProps);
 

See Also:
SessionFactory

Field Summary
static java.lang.String CONNPROP_CONNECTION_FACTORY
          This is the fully-qualified class name of the database connection factory.
static java.lang.String CONNPROP_DEBUG
          This is the debug setting connection property (optional) [default=false, true/false].
static java.lang.String CONNPROP_FOLDER_DELETED
          This is the name of the user's 'Deleted' folder (optional).
static java.lang.String CONNPROP_FOLDER_DRAFTS
          This is the name of the user's 'Drafts' folder (optional).
static java.lang.String CONNPROP_FOLDER_SENT
          This is the name of the user's 'Sent' folder (optional).
static java.lang.String CONNPROP_FROM
          This is the from email address connection property.
static java.lang.String CONNPROP_INCOMING_HOST
          This is the incoming host connection property.
static java.lang.String CONNPROP_INCOMING_HOST_PORT
          This is the incoming host port connection property (optional).
static java.lang.String CONNPROP_INCOMING_HOST_SSL
          This is the incoming host ssl connection property (optional) [default=false, true/false].
static java.lang.String CONNPROP_ORGANIZATION
          This is the name of the user's organization (optional).
static java.lang.String CONNPROP_OUTGOING_HOST
          This is the outgoing host connection property.
static java.lang.String CONNPROP_PASSWORD
          This is the user's password credential connection property.
static java.lang.String CONNPROP_PROTOCOL
          This is the protocol for the store/transport connection properties.
static java.lang.String CONNPROP_USER
          This is the user authentication connection property.
 
Method Summary
 void close()
          Closes the session and frees any remaining resources.
 IFolder createFolder(java.lang.String sName)
          Creates a with the specified name under the top-level root.
 IMessage createMessage()
          Creates a new message to prepare for sending.
 boolean getDebug()
          Gets the debug setting for this session instance.
 IFolder getDeletedFolder()
          Gets the 'Deleted' folder.
 java.lang.String getDeletedFolderName()
          Gets the deleted folder name.
 IFolder getDraftsFolder()
          Gets the 'Drafts' folder.
 java.lang.String getDraftsFolderName()
          Gets the drafts folder name.
 IFolder getFolder(java.lang.Object id)
          Gets a folder by the specified ID.
 java.util.List getFolders()
          Gets the top level folders.
 IFolder getInbox()
          Gets the 'INBOX' folder.
 java.lang.String getInboxFolderName()
          Gets the INBOX folder name.
 java.util.Properties getProperties()
          Gets the properties for this session.
 IFolder getSentFolder()
          Gets the 'Sent' folder.
 java.lang.String getSentFolderName()
          Gets the sent folder name.
 void refresh()
          Refreshes the cached content of this session.
 

Field Detail

CONNPROP_CONNECTION_FACTORY

public static final java.lang.String CONNPROP_CONNECTION_FACTORY
This is the fully-qualified class name of the database connection factory.

CONNPROP_INCOMING_HOST

public static final java.lang.String CONNPROP_INCOMING_HOST
This is the incoming host connection property.

CONNPROP_OUTGOING_HOST

public static final java.lang.String CONNPROP_OUTGOING_HOST
This is the outgoing host connection property.

CONNPROP_DEBUG

public static final java.lang.String CONNPROP_DEBUG
This is the debug setting connection property (optional) [default=false, true/false].

CONNPROP_PROTOCOL

public static final java.lang.String CONNPROP_PROTOCOL
This is the protocol for the store/transport connection properties.

CONNPROP_FROM

public static final java.lang.String CONNPROP_FROM
This is the from email address connection property.

CONNPROP_USER

public static final java.lang.String CONNPROP_USER
This is the user authentication connection property.

CONNPROP_PASSWORD

public static final java.lang.String CONNPROP_PASSWORD
This is the user's password credential connection property.

CONNPROP_FOLDER_DELETED

public static final java.lang.String CONNPROP_FOLDER_DELETED
This is the name of the user's 'Deleted' folder (optional).

CONNPROP_FOLDER_DRAFTS

public static final java.lang.String CONNPROP_FOLDER_DRAFTS
This is the name of the user's 'Drafts' folder (optional).

CONNPROP_FOLDER_SENT

public static final java.lang.String CONNPROP_FOLDER_SENT
This is the name of the user's 'Sent' folder (optional).

CONNPROP_ORGANIZATION

public static final java.lang.String CONNPROP_ORGANIZATION
This is the name of the user's organization (optional).

CONNPROP_INCOMING_HOST_PORT

public static final java.lang.String CONNPROP_INCOMING_HOST_PORT
This is the incoming host port connection property (optional).

CONNPROP_INCOMING_HOST_SSL

public static final java.lang.String CONNPROP_INCOMING_HOST_SSL
This is the incoming host ssl connection property (optional) [default=false, true/false].
Method Detail

refresh

public void refresh()
             throws MailException
Refreshes the cached content of this session. Cached content includes folders.

close

public void close()
Closes the session and frees any remaining resources.

getDebug

public boolean getDebug()
Gets the debug setting for this session instance. The default debug setting is the mail.debug property taken from mail.properties.
Returns:
true to print debug; false otherwise

getFolders

public java.util.List getFolders()
                          throws MailException
Gets the top level folders.
Returns:
a list of IFolder objects

getFolder

public IFolder getFolder(java.lang.Object id)
                  throws MailException
Gets a folder by the specified ID.
Parameters:
id - the folder ID to retrieve
Returns:
the folder or null if not found

getInbox

public IFolder getInbox()
                 throws MailException
Gets the 'INBOX' folder.
Returns:
the 'INBOX' folder

getDeletedFolder

public IFolder getDeletedFolder()
                         throws MailException
Gets the 'Deleted' folder.
Returns:
the 'Deleted' folder

getDraftsFolder

public IFolder getDraftsFolder()
                        throws MailException
Gets the 'Drafts' folder.
Returns:
the 'Drafts' folder

getSentFolder

public IFolder getSentFolder()
                      throws MailException
Gets the 'Sent' folder.
Returns:
the 'Sent' folder

getProperties

public java.util.Properties getProperties()
Gets the properties for this session. These are the properties used when the session was created.
Returns:
the properties

createFolder

public IFolder createFolder(java.lang.String sName)
                     throws MailException
Creates a with the specified name under the top-level root.

Hierarchies of folders can be created by entering a name like UserName/Personal/Friends, which will add a new folder called Friends under the directory Personal, which is under the top directory UserName.

Parameters:
sName - the name of the folder (may not be null or empty)
Returns:
the newly created folder or null if the create fails

createMessage

public IMessage createMessage()
                       throws MailException
Creates a new message to prepare for sending.
Returns:
the newly created message or null if the create fails

getDraftsFolderName

public java.lang.String getDraftsFolderName()
Gets the drafts folder name. This is determined by first checking if is a user property passed-in when the session was created; if empty or null, the folder.drafts.name from mail.properties is used.
Returns:
the drafts folder name

getSentFolderName

public java.lang.String getSentFolderName()
Gets the sent folder name. This is determined by first checking if is a user property passed-in when the session was created; if empty or null, the folder.sent.name from mail.properties is used.
Returns:
the sent folder name

getDeletedFolderName

public java.lang.String getDeletedFolderName()
Gets the deleted folder name. This is determined by first checking if is a user property passed-in when the session was created; if empty or null, the folder.deleted.name from mail.properties is used.
Returns:
the deleted folder name

getInboxFolderName

public java.lang.String getInboxFolderName()
Gets the INBOX folder name.
Returns:
the inbox folder name

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.