@PublicAPI(stability=VOLATILE, mayInstantiate=true, mayExtend=false, mayInvoke=true) public final class EMailMessage extends Object
Constructor and Description |
---|
EMailMessage(String sender,
List<String> recipients,
String subject)
Creates a new e-mail message with the provided information.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttachment(javax.mail.internet.MimeBodyPart attachment)
Adds the provided attachment to this mail message.
|
void |
addAttachment(String attachmentText)
Adds an attachment to this mail message with the provided text.
|
void |
addRecipient(String recipient)
Adds the specified recipient to this message.
|
void |
appendToBody(String text)
Appends the provided text to the body of this message.
|
List<javax.mail.internet.MimeBodyPart> |
getAttachments()
Retrieves the set of attachments for this message.
|
LocalizableMessageBuilder |
getBody()
Retrieves the body for this message.
|
String |
getBodyTextSubtype()
Retrieves the MIME text subtype for the body of this message.
|
List<String> |
getRecipients()
Retrieves the set of recipients for this message.
|
String |
getSender()
Retrieves the sender for this message.
|
String |
getSubject()
Retrieves the subject for this message.
|
static void |
main(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 |
setBody(LocalizableMessage body)
Specifies the body for this message.
|
void |
setBody(LocalizableMessageBuilder body)
Specifies the body for this message.
|
void |
setBodyTextSubtype(String bodyTextSubtype)
Specifies the MIME text subtype for the body of this message.
|
void |
setRecipients(ArrayList<String> recipients)
Specifies the set of recipients for this message.
|
void |
setSender(String sender)
Specifies the sender for this message.
|
void |
setSubject(String subject)
Specifies the subject for this message.
|
public EMailMessage(String sender, List<String> recipients, 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.public String getSender()
public void setSender(String sender)
sender
- The sender for this message.public List<String> getRecipients()
public void setRecipients(ArrayList<String> recipients)
recipients
- The set of recipients for this message.public void addRecipient(String recipient)
recipient
- The recipient to add to this message.public String getSubject()
public void setSubject(String subject)
subject
- The subject for this message.public String getBodyTextSubtype()
public void setBodyTextSubtype(String bodyTextSubtype)
bodyTextSubtype
- The MIME text subtype for this message.public LocalizableMessageBuilder getBody()
public void setBody(LocalizableMessageBuilder body)
body
- The body for this message.public void setBody(LocalizableMessage body)
body
- The body for this message.public void appendToBody(String text)
text
- The text to append to the body of the message.public List<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(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 send() throws javax.mail.MessagingException
javax.mail.MessagingException
- If a problem occurred while attempting to send the message.public static void main(String[] args)
args
- The command-line arguments provided to this program.Copyright 2010-2022 ForgeRock AS.