com.moyosoft.exchange.mail
Interface ExchangeMail

All Superinterfaces:
ExchangeItem
All Known Subinterfaces:
ExchangeMeetingMessage, ExchangeMeetingRequest, ExchangeResponseMail

public interface ExchangeMail
extends ExchangeItem

Represents an e-mail message stored in an Exchange folder.

A new e-mail can be created with the method ExchangeFolder.createMail(). To save the new e-mail to the folder, call the method save().

This class provides getter and setter methods to access or modify the message's properties.

Example code that displays e-mails from the Inbox received in the past 24 hours:

Exchange exchange = new Exchange("hostname", "username", "password");
ExchangeFolder inbox = exchange.getInboxFolder();

Date now = new Date();
Date oneDayAgo = new Date(now.getTime() - 86400000);

Restriction restriction =
  If.Item.DateTimeReceived.isAfterOrEqualTo(oneDayAgo).and().isBefore(now);

ItemsCollection items = inbox.getItems().
  restrict(restriction).sortBy(ExchangeItemField.item_DateTimeReceived);

System.out.println("E-mails found: " + items.getCount());

for(ExchangeItem item : items)
{
  ExchangeMail mail = (ExchangeMail) item;
  System.out.println(mail.getSubject());
}

See Also:
ExchangeFolder.createMail(), ExchangeItem.save()

Method Summary
 void addBccRecipient(java.lang.String emailAddress)
           
 void addCcRecipient(java.lang.String emailAddress)
           
 void addReplyTo(java.lang.String emailAddress)
           
 void addToRecipient(java.lang.String emailAddress)
           
 ExchangeMail forward()
           
 java.util.List<ExchangeMailbox> getBccRecipientsMailboxes()
           
 java.util.List<ExchangeMailbox> getCcRecipientsMailboxes()
           
 byte[] getConversationIndex()
           
 java.lang.String getConversationTopic()
           
 java.lang.String getFromEmailAddress()
           
 ExchangeMailbox getFromMailbox()
           
 java.lang.String getFromName()
           
 java.lang.String getInternetMessageId()
           
 ExchangeMailbox getReceivedByMailbox()
           
 ExchangeMailbox getReceivedRepresentingMailbox()
           
 java.lang.String getReferences()
           
 java.util.List<ExchangeMailbox> getReplyToMailboxes()
           
 java.lang.String getSenderEmailAddress()
           
 ExchangeMailbox getSenderMailbox()
           
 java.lang.String getSenderName()
           
 java.util.List<ExchangeMailbox> getToRecipientsMailboxes()
           
 boolean isDeliveryReceiptRequested()
           
 boolean isRead()
           
 boolean isReadReceiptRequested()
           
 boolean isResponseRequested()
           
 ExchangeMail reply()
          Creates a reply to this email message.
 ExchangeMail replyAll()
           
 void send()
          Sends this email message.
 void setBccRecipient(java.lang.String emailAddress)
           
 void setBccRecipients(java.util.List<java.lang.String> emailAddresses)
           
 void setCcRecipient(java.lang.String emailAddress)
           
 void setCcRecipients(java.util.List<java.lang.String> emailAddresses)
           
 void setConversationTopic(java.lang.String conversationTopic)
           
 void setFrom(java.lang.String from)
           
 void setInternetMessageId(java.lang.String internetMessageId)
           
 void setIsDeliveryReceiptRequested(boolean isDeliveryReceiptRequested)
           
 void setIsRead(boolean isRead)
           
 void setIsReadReceiptRequested(boolean isReadReceiptRequested)
           
 void setIsResponseRequested(boolean isResponseRequested)
           
 void setReferences(java.lang.String references)
           
 void setReplyTo(java.util.List<java.lang.String> emailAddresses)
           
 void setReplyTo(java.lang.String emailAddress)
           
 void setToRecipient(java.lang.String emailAddress)
           
 void setToRecipients(java.util.List<java.lang.String> emailAddresses)
           
 
Methods inherited from interface com.moyosoft.exchange.item.ExchangeItem
copyTo, copyTo, delete, getAttachments, getBody, getBodyAsText, getBodyType, getCategories, getCulture, getDateTimeCreated, getDateTimeReceived, getDateTimeSent, getDisplayCc, getDisplayTo, getExtendedProperties, getImportance, getInReplyTo, getInternetMessageHeaders, getItemClass, getItemId, getItemIdChangeKey, getItemType, getLastModifiedName, getLastModifiedTime, getMimeContent, getMimeContentBytes, getMimeContentCharacterSet, getMimeContentReader, getMimeContentStream, getParentFolder, getParentFolderId, getParentFolderIdChangeKey, getReminderDueBy, getReminderMinutesBeforeStart, getResponsesTypes, getSensitivity, getSize, getSubject, hasVisibleAttachments, isDraft, isFromMe, isReminderSet, isResend, isStored, isSubmitted, moveTo, moveTo, save, save, saveTo, setBody, setBody, setCategories, setCulture, setImportance, setMimeContent, setMimeContent, setMimeContent, setReminder, setSensitivity, setSubject
 

Method Detail

getSenderName

java.lang.String getSenderName()
                               throws ExchangeServiceException
Throws:
ExchangeServiceException

getSenderEmailAddress

java.lang.String getSenderEmailAddress()
                                       throws ExchangeServiceException
Throws:
ExchangeServiceException

getSenderMailbox

ExchangeMailbox getSenderMailbox()
                                 throws ExchangeServiceException
Throws:
ExchangeServiceException

setToRecipients

void setToRecipients(java.util.List<java.lang.String> emailAddresses)
                     throws ExchangeServiceException
Throws:
ExchangeServiceException

addToRecipient

void addToRecipient(java.lang.String emailAddress)
                    throws ExchangeServiceException
Throws:
ExchangeServiceException

setToRecipient

void setToRecipient(java.lang.String emailAddress)
                    throws ExchangeServiceException
Throws:
ExchangeServiceException

getToRecipientsMailboxes

java.util.List<ExchangeMailbox> getToRecipientsMailboxes()
                                                         throws ExchangeServiceException
Throws:
ExchangeServiceException

setCcRecipients

void setCcRecipients(java.util.List<java.lang.String> emailAddresses)
                     throws ExchangeServiceException
Throws:
ExchangeServiceException

addCcRecipient

void addCcRecipient(java.lang.String emailAddress)
                    throws ExchangeServiceException
Throws:
ExchangeServiceException

setCcRecipient

void setCcRecipient(java.lang.String emailAddress)
                    throws ExchangeServiceException
Throws:
ExchangeServiceException

getCcRecipientsMailboxes

java.util.List<ExchangeMailbox> getCcRecipientsMailboxes()
                                                         throws ExchangeServiceException
Throws:
ExchangeServiceException

setBccRecipients

void setBccRecipients(java.util.List<java.lang.String> emailAddresses)
                      throws ExchangeServiceException
Throws:
ExchangeServiceException

addBccRecipient

void addBccRecipient(java.lang.String emailAddress)
                     throws ExchangeServiceException
Throws:
ExchangeServiceException

setBccRecipient

void setBccRecipient(java.lang.String emailAddress)
                     throws ExchangeServiceException
Throws:
ExchangeServiceException

getBccRecipientsMailboxes

java.util.List<ExchangeMailbox> getBccRecipientsMailboxes()
                                                          throws ExchangeServiceException
Throws:
ExchangeServiceException

isReadReceiptRequested

boolean isReadReceiptRequested()
                               throws ExchangeServiceException
Throws:
ExchangeServiceException

setIsReadReceiptRequested

void setIsReadReceiptRequested(boolean isReadReceiptRequested)
                               throws ExchangeServiceException
Throws:
ExchangeServiceException

isDeliveryReceiptRequested

boolean isDeliveryReceiptRequested()
                                   throws ExchangeServiceException
Throws:
ExchangeServiceException

setIsDeliveryReceiptRequested

void setIsDeliveryReceiptRequested(boolean isDeliveryReceiptRequested)
                                   throws ExchangeServiceException
Throws:
ExchangeServiceException

getConversationIndex

byte[] getConversationIndex()
                            throws ExchangeServiceException
Throws:
ExchangeServiceException

getConversationTopic

java.lang.String getConversationTopic()
                                      throws ExchangeServiceException
Throws:
ExchangeServiceException

setConversationTopic

void setConversationTopic(java.lang.String conversationTopic)
                          throws ExchangeServiceException
Throws:
ExchangeServiceException

getFromName

java.lang.String getFromName()
                             throws ExchangeServiceException
Throws:
ExchangeServiceException

getFromEmailAddress

java.lang.String getFromEmailAddress()
                                     throws ExchangeServiceException
Throws:
ExchangeServiceException

setFrom

void setFrom(java.lang.String from)
             throws ExchangeServiceException
Throws:
ExchangeServiceException

getFromMailbox

ExchangeMailbox getFromMailbox()
                               throws ExchangeServiceException
Throws:
ExchangeServiceException

getInternetMessageId

java.lang.String getInternetMessageId()
                                      throws ExchangeServiceException
Throws:
ExchangeServiceException

setInternetMessageId

void setInternetMessageId(java.lang.String internetMessageId)
                          throws ExchangeServiceException
Throws:
ExchangeServiceException

isRead

boolean isRead()
               throws ExchangeServiceException
Throws:
ExchangeServiceException

setIsRead

void setIsRead(boolean isRead)
               throws ExchangeServiceException
Throws:
ExchangeServiceException

isResponseRequested

boolean isResponseRequested()
                            throws ExchangeServiceException
Throws:
ExchangeServiceException

setIsResponseRequested

void setIsResponseRequested(boolean isResponseRequested)
                            throws ExchangeServiceException
Throws:
ExchangeServiceException

getReferences

java.lang.String getReferences()
                               throws ExchangeServiceException
Throws:
ExchangeServiceException

setReferences

void setReferences(java.lang.String references)
                   throws ExchangeServiceException
Throws:
ExchangeServiceException

setReplyTo

void setReplyTo(java.util.List<java.lang.String> emailAddresses)
                throws ExchangeServiceException
Throws:
ExchangeServiceException

addReplyTo

void addReplyTo(java.lang.String emailAddress)
                throws ExchangeServiceException
Throws:
ExchangeServiceException

setReplyTo

void setReplyTo(java.lang.String emailAddress)
                throws ExchangeServiceException
Throws:
ExchangeServiceException

getReplyToMailboxes

java.util.List<ExchangeMailbox> getReplyToMailboxes()
                                                    throws ExchangeServiceException
Throws:
ExchangeServiceException

getReceivedByMailbox

ExchangeMailbox getReceivedByMailbox()
                                     throws ExchangeServiceException
Throws:
ExchangeServiceException

getReceivedRepresentingMailbox

ExchangeMailbox getReceivedRepresentingMailbox()
                                               throws ExchangeServiceException
Throws:
ExchangeServiceException

reply

ExchangeMail reply()
                   throws ExchangeServiceException
Creates a reply to this email message. To send the created reply, the method send() has to be called on the returned ExchangeMail object.

Throws:
ExchangeServiceException

replyAll

ExchangeMail replyAll()
                      throws ExchangeServiceException
Throws:
ExchangeServiceException

forward

ExchangeMail forward()
                     throws ExchangeServiceException
Throws:
ExchangeServiceException

send

void send()
          throws ExchangeServiceException
Sends this email message.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.