org.jboss.seam.mail.api
Interface MailMessage


public interface MailMessage

Base interface for creating email messages.

Author:
Cody Lerum

Method Summary
 MailMessage addAttachment(ContentDisposition contentDispostion, File file)
          Adds Attachment to the message
 MailMessage addAttachment(EmailAttachment attachment)
          Adds Attachment to the message
 MailMessage addAttachment(String fileName, String mimeType, ContentDisposition contentDispostion, byte[] bytes)
          Adds Attachment to the message
 MailMessage addAttachment(String fileName, String mimeType, ContentDisposition contentDispostion, InputStream inputStream)
          Adds Attachment to the message
 MailMessage addAttachments(Collection<? extends EmailAttachment> attachments)
          Adds a Collection of Attachments to the message
 MailMessage addHeader(String name, String value)
          Add header to the message.
 MailMessage bcc(Collection<? extends EmailContact> emailContacts)
          Add collection of BCC (Blind Carbon Copy) recipients
 MailMessage bcc(EmailContact emailContact)
          Add BCC recipient
 MailMessage bcc(InternetAddress emailAddress)
          Add BCC (Blind Carbon Copy) recipient
 MailMessage bcc(String... address)
          Convenience varargs method to add BCC address(es)
 MailMessage bodyHtml(String html)
          Sets the body of the message a HTML body represented by the supplied string
 MailMessage bodyHtml(TemplateProvider htmlBody)
          Sets the HTML body of the message to the HTML output of the given template
 MailMessage bodyHtmlTextAlt(String html, String text)
          Sets the body of the message to a HTML body with a plain text alternative
 MailMessage bodyHtmlTextAlt(TemplateProvider htmlBody, TemplateProvider textBody)
          Sets the body of the message to a HTML body with a plain text alternative output of the given templates
 MailMessage bodyText(String text)
          Sets the body of the message a plan text body represented by the supplied string
 MailMessage bodyText(TemplateProvider textBody)
          Sets the text body of the message to the plain text output of the given template
 MailMessage cc(Collection<? extends EmailContact> emailContacts)
          Add collection of CC (Carbon Copy) recipients
 MailMessage cc(EmailContact emailContact)
          Add CC recipient
 MailMessage cc(InternetAddress emailAddress)
          Add CC (Carbon Copy) recipient
 MailMessage cc(String... address)
          Convenience varargs method to add CC address(es)
 MailMessage contentType(ContentType contentType)
          Set the Content Type of the message
 MailMessage deliveryReceipt(String address)
          Request a delivery receipt "Return-Receipt-To" to the given address
 MailMessage from(Collection<? extends EmailContact> emailContacts)
          Adds a Collection of EmailContact as FROM addresses
 MailMessage from(EmailContact emailContact)
          Adds a From Address
 MailMessage from(InternetAddress emailAddress)
          Adds a From Address
 MailMessage from(String... address)
          Convenience varargs method to add FROM address(es)
 EmailMessage getEmailMessage()
          Get the EmailMessage representing this MailMessage
 MailMessage iCal(String htmlSummary, byte[] bytes)
          Used for creating iCal Calendar Invites.
 MailMessage importance(MessagePriority messagePriority)
          Sets the importance level of the message with a given MessagePriority
 EmailMessage mergeTemplates()
          Merge the templates with the context
 MailMessage messageId(String messageId)
          Set the Message-ID for the message.
 MailMessage put(Map<String,Object> values)
          Places a Map of variable in the templating engines context
 MailMessage put(String name, Object value)
          Places a variable in the templating engines context
 MailMessage readReceipt(String address)
          Request a read receipt "Disposition-Notification-To" to a given address
 MailMessage replyTo(Collection<? extends EmailContact> emailContacts)
          Adds a Collection of EmailContact as REPLY-TO addresses
 MailMessage replyTo(EmailContact emailContact)
          Adds a REPLY-TO Address
 MailMessage replyTo(InternetAddress emailAddress)
          Adds a REPLY-TO Address
 MailMessage replyTo(String... address)
          Convenience varargs method to add REPLY-TO address(es)
 EmailMessage send()
          Send the Message using a default mail session created from a configured MailConfig
 EmailMessage send(MailConfig mailConfig)
          Send the Message using a JavaMail session created from this specific MailConfig
 EmailMessage send(MailTransporter mailTransporter)
          Send the Message
 EmailMessage send(Session session)
          Send the Message using a specific JavaMail session
 void setEmailMessage(EmailMessage emailMessage)
          Set the EmailMessage representing this MailMessage
 MailMessage subject(String value)
          Set the subject on the message
 MailMessage subject(TemplateProvider subject)
          Set the template to be used for the message subject
 MailMessage to(Collection<? extends EmailContact> emailContacts)
          Convenience method to add a TO recipients
 MailMessage to(EmailContact emailContact)
          Add TO recipient
 MailMessage to(InternetAddress emailAddress)
          Add TO recipient
 MailMessage to(String... address)
          Convenience varargs method to add TO address(es)
 

Method Detail

from

MailMessage from(String... address)
Convenience varargs method to add FROM address(es)

Parameters:
address - Address of the recipient eq "john.doe@example.com" or "John Doe"
Throws:
InvalidAddressException - if address(es) are in an invalid format

from

MailMessage from(InternetAddress emailAddress)
Adds a From Address

Parameters:
emailAddress - InternetAddress of the address to be added

from

MailMessage from(EmailContact emailContact)
Adds a From Address

Parameters:
emailContact - EmailContact of the address to be added

from

MailMessage from(Collection<? extends EmailContact> emailContacts)
Adds a Collection of EmailContact as FROM addresses

Parameters:
emailContacts - Collection of EmailContact to be added

replyTo

MailMessage replyTo(String... address)
Convenience varargs method to add REPLY-TO address(es)

Parameters:
address - Address of the recipient eq "john.doe@example.com" or "John Doe"
Throws:
InvalidAddressException - if address(es) are in an invalid format

replyTo

MailMessage replyTo(InternetAddress emailAddress)
Adds a REPLY-TO Address

Parameters:
emailAddress - InternetAddress of the address to be added

replyTo

MailMessage replyTo(EmailContact emailContact)
Adds a REPLY-TO Address

Parameters:
emailContact - EmailContact of the address to be added

replyTo

MailMessage replyTo(Collection<? extends EmailContact> emailContacts)
Adds a Collection of EmailContact as REPLY-TO addresses

Parameters:
emailContacts - Collection of EmailContact to be added

addHeader

MailMessage addHeader(String name,
                      String value)
Add header to the message.

Parameters:
name - Header name
value - Header value

to

MailMessage to(String... address)
Convenience varargs method to add TO address(es)

Parameters:
address - Address of the recipient eq "john.doe@example.com" or "John Doe"
Throws:
InvalidAddressException - if address(es) are in an invalid format

to

MailMessage to(InternetAddress emailAddress)
Add TO recipient

Parameters:
emailAddress - InternetAddress of the address to be added

to

MailMessage to(EmailContact emailContact)
Add TO recipient

Parameters:
emailContact - EmailContact of the address to be added

to

MailMessage to(Collection<? extends EmailContact> emailContacts)
Convenience method to add a TO recipients

Parameters:
emailContacts - Collection of EmailContact to be added

cc

MailMessage cc(String... address)
Convenience varargs method to add CC address(es)

Parameters:
address - Address of the recipient eq "john.doe@example.com" or "John Doe"
Throws:
InvalidAddressException - if address(es) are in an invalid format

cc

MailMessage cc(InternetAddress emailAddress)
Add CC (Carbon Copy) recipient

Parameters:
emailAddress - InternetAddress of the address to be added

cc

MailMessage cc(EmailContact emailContact)
Add CC recipient

Parameters:
emailContact - EmailContact of the address to be added

cc

MailMessage cc(Collection<? extends EmailContact> emailContacts)
Add collection of CC (Carbon Copy) recipients

Parameters:
emailContacts - Collection of EmailContact to be added

bcc

MailMessage bcc(String... address)
Convenience varargs method to add BCC address(es)

Parameters:
address - Address of the recipient eq "john.doe@example.com" or "John Doe"
Throws:
InvalidAddressException - if address(es) are in an invalid format

bcc

MailMessage bcc(InternetAddress emailAddress)
Add BCC (Blind Carbon Copy) recipient

Parameters:
emailAddress - InternetAddress of the address to be added

bcc

MailMessage bcc(EmailContact emailContact)
Add BCC recipient

Parameters:
emailContact - EmailContact of the address to be added

bcc

MailMessage bcc(Collection<? extends EmailContact> emailContacts)
Add collection of BCC (Blind Carbon Copy) recipients

Parameters:
emailContacts - Collection of EmailContact to be added

addAttachment

MailMessage addAttachment(EmailAttachment attachment)
Adds Attachment to the message

Parameters:
attachment - EmailAttachment to be added

addAttachments

MailMessage addAttachments(Collection<? extends EmailAttachment> attachments)
Adds a Collection of Attachments to the message

Parameters:
attachments -

addAttachment

MailMessage addAttachment(String fileName,
                          String mimeType,
                          ContentDisposition contentDispostion,
                          byte[] bytes)
Adds Attachment to the message

Parameters:
fileName -
mimeType -
contentDispostion -
bytes -

addAttachment

MailMessage addAttachment(String fileName,
                          String mimeType,
                          ContentDisposition contentDispostion,
                          InputStream inputStream)
Adds Attachment to the message

Parameters:
fileName -
mimeType -
contentDispostion -
inputStream -

addAttachment

MailMessage addAttachment(ContentDisposition contentDispostion,
                          File file)
Adds Attachment to the message

Parameters:
contentDispostion -
file -

importance

MailMessage importance(MessagePriority messagePriority)
Sets the importance level of the message with a given MessagePriority

Parameters:
messagePriority - The priority level of the message.

deliveryReceipt

MailMessage deliveryReceipt(String address)
Request a delivery receipt "Return-Receipt-To" to the given address

Parameters:
address - Email address the receipt should be sent to
Throws:
InvalidAddressException - if address is in invalid format

readReceipt

MailMessage readReceipt(String address)
Request a read receipt "Disposition-Notification-To" to a given address

Parameters:
address - Email address the receipt should be sent to
Throws:
InvalidAddressException - if address is in invalid format

messageId

MailMessage messageId(String messageId)
Set the Message-ID for the message.

Parameters:
messageId -

iCal

MailMessage iCal(String htmlSummary,
                 byte[] bytes)
Used for creating iCal Calendar Invites.

Parameters:
htmlSummary - Summary of the invite to be displayed in the body of the email messages.
bytes - iCal data which will be attached to the message

subject

MailMessage subject(String value)
Set the subject on the message

Parameters:
value - Subject of the message

bodyText

MailMessage bodyText(String text)
Sets the body of the message a plan text body represented by the supplied string

Parameters:
text - Plain text body

bodyHtml

MailMessage bodyHtml(String html)
Sets the body of the message a HTML body represented by the supplied string

Parameters:
html - HTML body

bodyHtmlTextAlt

MailMessage bodyHtmlTextAlt(String html,
                            String text)
Sets the body of the message to a HTML body with a plain text alternative

Parameters:
html - HTML body
text - Plain text body

contentType

MailMessage contentType(ContentType contentType)
Set the Content Type of the message

Parameters:
contentType -

getEmailMessage

EmailMessage getEmailMessage()
Get the EmailMessage representing this MailMessage

Returns:
EmailMessage representing this MailMessage

setEmailMessage

void setEmailMessage(EmailMessage emailMessage)
Set the EmailMessage representing this MailMessage


mergeTemplates

EmailMessage mergeTemplates()
Merge the templates with the context

Returns:
EmailMessage representing this MailMessage after merging

send

EmailMessage send(MailTransporter mailTransporter)
Send the Message

Parameters:
mailTransporter - MailTransporter instance to used to send the MailMessage
Returns:
EmailMessage which represents the MailMessage as sent
Throws:
SendFailedException - If the messages fails to be sent.

send

EmailMessage send(Session session)
Send the Message using a specific JavaMail session

Parameters:
session - Session to use to send the MailMessage
Returns:
EmailMessage which represents the MailMessage as sent
Throws:
SendFailedException - If the messages fails to be sent.

send

EmailMessage send(MailConfig mailConfig)
Send the Message using a JavaMail session created from this specific MailConfig

Parameters:
mailConfig - MailConfig to use to send the MailMessage
Returns:
EmailMessage which represents the MailMessage as sent
Throws:
SendFailedException - If the messages fails to be sent.

send

EmailMessage send()
Send the Message using a default mail session created from a configured MailConfig

Returns:
EmailMessage which represents the MailMessage as sent
Throws:
SendFailedException - If the messages fails to be sent.

subject

MailMessage subject(TemplateProvider subject)
Set the template to be used for the message subject

Parameters:
subject - TemplateProvider to use
Throws:
TemplatingException

bodyText

MailMessage bodyText(TemplateProvider textBody)
Sets the text body of the message to the plain text output of the given template

Parameters:
textBody - TemplateProvider to use
Throws:
TemplatingException

bodyHtml

MailMessage bodyHtml(TemplateProvider htmlBody)
Sets the HTML body of the message to the HTML output of the given template

Parameters:
htmlBody - TemplateProvider to use
Throws:
TemplatingException

bodyHtmlTextAlt

MailMessage bodyHtmlTextAlt(TemplateProvider htmlBody,
                            TemplateProvider textBody)
Sets the body of the message to a HTML body with a plain text alternative output of the given templates

Parameters:
htmlBody - TemplateProvider to use for HTML portion of message
textBody - TemplateProvider to use for Text alternative portion of message
Throws:
TemplatingException

put

MailMessage put(String name,
                Object value)
Places a variable in the templating engines context

Parameters:
name - Reference name of the object
value - the Object being placed in the context

put

MailMessage put(Map<String,Object> values)
Places a Map of variable in the templating engines context

Parameters:
values - Map containing the variables to be placed in the context


Copyright © 2011 Seam Framework. All Rights Reserved.