|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.util.EMailMessage
@PublicAPI(stability=VOLATILE, mayInstantiate=true, mayExtend=false, mayInvoke=true) public final class EMailMessage
This class defines an e-mail message that may be sent to one or more recipients via SMTP. This is a wrapper around JavaMail to make this process more convenient and fit better into the Directory Server framework.
Constructor Summary | |
---|---|
EMailMessage(java.lang.String sender,
java.util.List<java.lang.String> recipients,
java.lang.String subject)
Creates a new e-mail message with the provided information. |
|
EMailMessage(java.lang.String sender,
java.lang.String recipient,
java.lang.String subject)
Creates a new e-mail message with the provided information. |
Method Summary | |
---|---|
void |
addAttachment(java.io.File attachmentFile)
Adds the provided attachment to this mail message. |
void |
addAttachment(javax.mail.internet.MimeBodyPart attachment)
Adds the provided attachment to this mail message. |
void |
addAttachment(java.lang.String attachmentText)
Adds an attachment to this mail message with the provided text. |
void |
addRecipient(java.lang.String recipient)
Adds the specified recipient to this message. |
void |
appendToBody(java.lang.String text)
Appends the provided text to the body of this message. |
java.util.LinkedList<javax.mail.internet.MimeBodyPart> |
getAttachments()
Retrieves the set of attachments for this message. |
MessageBuilder |
getBody()
Retrieves the body for this message. |
java.util.List<java.lang.String> |
getRecipients()
Retrieves the set of recipients for this message. |
java.lang.String |
getSender()
Retrieves the sender for this message. |
java.lang.String |
getSubject()
Retrieves the subject for this message. |
static void |
main(java.lang.String[] args)
Provide a command-line mechanism for sending an e-mail message via SMTP. |
void |
send()
Attempts to send this message to the intended recipient(s). |
void |
send(java.util.List<java.util.Properties> mailServerPropertySets)
Attempts to send this message to the intended recipient(s). |
void |
setBody(Message body)
Specifies the body for this message. |
void |
setBody(MessageBuilder body)
Specifies the body for this message. |
void |
setRecipients(java.util.ArrayList<java.lang.String> recipients)
Specifies the set of recipients for this message. |
void |
setSender(java.lang.String sender)
Specifies the sender for this message. |
void |
setSubject(java.lang.String subject)
Specifies the subject for this message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EMailMessage(java.lang.String sender, java.lang.String recipient, java.lang.String subject)
sender
- The address of the sender for the message.recipient
- The address of the recipient for the message.subject
- The subject to use for the message.public EMailMessage(java.lang.String sender, java.util.List<java.lang.String> recipients, java.lang.String subject)
sender
- The address of the sender for the message.recipients
- The addresses of the recipients for the message.subject
- The subject to use for the message.Method Detail |
---|
public java.lang.String getSender()
public void setSender(java.lang.String sender)
sender
- The sender for this message.public java.util.List<java.lang.String> getRecipients()
public void setRecipients(java.util.ArrayList<java.lang.String> recipients)
recipients
- The set of recipients for this message.public void addRecipient(java.lang.String recipient)
recipient
- The recipient to add to this message.public java.lang.String getSubject()
public void setSubject(java.lang.String subject)
subject
- The subject for this message.public MessageBuilder getBody()
public void setBody(MessageBuilder body)
body
- The body for this message.public void setBody(Message body)
body
- The body for this message.public void appendToBody(java.lang.String text)
text
- The text to append to the body of the message.public java.util.LinkedList<javax.mail.internet.MimeBodyPart> getAttachments()
public void addAttachment(javax.mail.internet.MimeBodyPart attachment)
attachment
- The attachment to add to this mail message.public void addAttachment(java.lang.String attachmentText) throws javax.mail.MessagingException
attachmentText
- The text to include in the attachment.
javax.mail.MessagingException
- If there is a problem of some type with the
attachment.public void addAttachment(java.io.File attachmentFile) throws javax.mail.MessagingException
attachmentFile
- The file containing the attachment data.
javax.mail.MessagingException
- If there is a problem of some type with the
attachment.public void send() throws javax.mail.MessagingException
javax.mail.MessagingException
- If a problem occurred while attempting to send
the message.public void send(java.util.List<java.util.Properties> mailServerPropertySets) throws javax.mail.MessagingException
mailServerPropertySets
- A list of property sets providing
information about the mail servers to use
when sending the message.
javax.mail.MessagingException
- If a problem occurred while attempting to send
the message.public static void main(java.lang.String[] args)
args
- The command-line arguments provided to this program.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |