com.jniwrapper.win32.mapi
Class MapiMessage

java.lang.Object
  extended by com.jniwrapper.win32.mapi.MapiMessage

public class MapiMessage
extends java.lang.Object

This class is designed for creating and sending email messages using MAPI.


Constructor Summary
MapiMessage()
          Creates a new empty message.
MapiMessage(java.util.List to)
          Creates a new empty message.
MapiMessage(MailContact to)
          Creates a new empty message.
MapiMessage(MailContact from, java.util.List to)
          Creates a new empty message.
MapiMessage(MailContact from, MailContact to)
          Creates a new empty message.
 
Method Summary
 void addRecipient(MailContact recipient)
          Adds the specified recipient to the list of the message receivers.
 void addRecipients(java.util.List recipients)
          Add the list of recipients of the message.
 void attachFile(java.io.File file)
          Attaches the specified file to the message.
 void attachFiles(java.util.List files)
          Attaches the list of files to the message.
 java.util.List getAttachedFiles()
          Returns the list of files attached to the message.
 java.util.List getRecipients()
          Returns the list of recipients of the message.
 MailContact getSender()
          Returns the sender of the message.
 java.lang.String getSubject()
          Returns the subject of the message.
 java.lang.String getText()
          Returns the content of the message.
 boolean isLogonUI()
          Returns true if the logon dialog window will appear in case the e-mail account login/password is incorrect.
 boolean removeAttachedFile(java.io.File file)
          Removes the specified first the message attachements.
 boolean removeRecipient(MailContact recipient)
          Removes the specified mail recipient from the list of the message receivers.
 boolean send(boolean showDialog)
          Sends the current message.
 void setLogonUI(boolean logonUI)
          Determines if the logon dialog window will appear in case the e-mail account login/password is incorrect.
 void setSender(MailContact sender)
          Specifies the sender of the message.
 void setSubject(java.lang.String subject)
          Specifies the subject of the message.
 void setText(java.lang.String text)
          Specifies the content of the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapiMessage

public MapiMessage()
Creates a new empty message.


MapiMessage

public MapiMessage(MailContact to)
Creates a new empty message.

Parameters:
to - is the receiver of the message.
Throws:
java.lang.IllegalArgumentException - if the specified mail receiver is of the SENDER type.

MapiMessage

public MapiMessage(MailContact from,
                   MailContact to)
Creates a new empty message.

Parameters:
from - specifies the sender of the message.
to - is the receiver of the message.
Throws:
java.lang.IllegalArgumentException - if the specified mail receiver is of the SENDER type or the specified mail sender is not if the SENDER type.

MapiMessage

public MapiMessage(java.util.List to)
Creates a new empty message.

Parameters:
to - a list of message receivers. Each item of the list is an instance of the MailContact class.
Throws:
java.lang.IllegalArgumentException - if one the specified mail receivers is of the SENDER type.

MapiMessage

public MapiMessage(MailContact from,
                   java.util.List to)
Creates a new empty message.

Parameters:
from - is the sender of the message.
to - a list of message receivers. Each item of the list is an instance of the MailContact class.
Throws:
java.lang.IllegalArgumentException - if the one of the specified mail receivers is of the SENDER type or the specified mail sender is not if the SENDER type.
Method Detail

send

public boolean send(boolean showDialog)
             throws MapiException
Sends the current message.

Parameters:
showDialog - if true, the dialog window will be shown.
Returns:
true if the message was successfully sent.
Throws:
MapiException

getSubject

public java.lang.String getSubject()
Returns the subject of the message.

Returns:
the subject of the message.

setSubject

public void setSubject(java.lang.String subject)
Specifies the subject of the message.

Parameters:
subject - is the subject of the message.

getText

public java.lang.String getText()
Returns the content of the message.

Returns:
the content of the message.

setText

public void setText(java.lang.String text)
Specifies the content of the message.

Parameters:
text - is the content of the message.

getRecipients

public java.util.List getRecipients()
Returns the list of recipients of the message. Each item of the list is an instance of the MailContact class.

Returns:
the list of the message receivers.

addRecipients

public void addRecipients(java.util.List recipients)
Add the list of recipients of the message. Each item of the list is an instance of the MailContact class. Each mail receiver cannot be of the SENDER type.

Parameters:
recipients - is the list of message receivers.
Throws:
java.lang.IllegalArgumentException - if one the specified mail receivers is of the SENDER type.

addRecipient

public void addRecipient(MailContact recipient)
Adds the specified recipient to the list of the message receivers. Note that receiver cannot be of the SENDER type.

Parameters:
recipient - is the recipient to be added.
Throws:
java.lang.IllegalArgumentException - if the specified mail receiver is of the SENDER type.

removeRecipient

public boolean removeRecipient(MailContact recipient)
Removes the specified mail recipient from the list of the message receivers.

Parameters:
recipient - is the mail receiver to be removed.

getSender

public MailContact getSender()
Returns the sender of the message.


setSender

public void setSender(MailContact sender)
Specifies the sender of the message. Note that sender should be of the SENDER type.

Parameters:
sender - is the sender of the message.
Throws:
java.lang.IllegalArgumentException - if the specified mail sender is not if the SENDER type.

getAttachedFiles

public java.util.List getAttachedFiles()
Returns the list of files attached to the message. Each item is an instance of the File class.

Returns:
the list of files attached to the message. Each item is an instance of the File class.

attachFiles

public void attachFiles(java.util.List files)
Attaches the list of files to the message. Each item is an instance of the File class.

Parameters:
files - is the list of files to be attached to the message.

attachFile

public void attachFile(java.io.File file)
Attaches the specified file to the message.

Parameters:
file - is the file to be attached.

removeAttachedFile

public boolean removeAttachedFile(java.io.File file)
Removes the specified first the message attachements.

Parameters:
file - is the file to be removed.

isLogonUI

public boolean isLogonUI()
Returns true if the logon dialog window will appear in case the e-mail account login/password is incorrect.


setLogonUI

public void setLogonUI(boolean logonUI)
Determines if the logon dialog window will appear in case the e-mail account login/password is incorrect.

Parameters:
logonUI - if true, the logon dialog window will appear in case the e-mail account login/password is incorrect.