public static class MailService.Message
extends java.lang.Object
send
and sendToAdmins
methods.Constructor and Description |
---|
Message() |
Message(java.lang.String sender,
java.lang.String to,
java.lang.String subject,
java.lang.String textBody)
Convenience constructor for simple messages
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAmpHtmlBody()
Gets the AMP HTML body of this message.
|
java.util.Collection<MailService.Attachment> |
getAttachments()
Gets the attachments of this message.
|
java.util.Collection<java.lang.String> |
getBcc()
Gets the recipients in the 'bcc' field of this message.
|
java.util.Collection<java.lang.String> |
getCc()
Gets the recipients in the 'cc' field of this message.
|
java.util.Collection<MailService.Header> |
getHeaders()
Gets the headers of this message.
|
java.lang.String |
getHtmlBody()
Gets the html body of this message.
|
java.lang.String |
getReplyTo()
Gets the reply to field of this message.
|
java.lang.String |
getSender()
Gets the sender of this message.
|
java.lang.String |
getSubject()
Gets the subject of this message.
|
java.lang.String |
getTextBody()
Gets the text body of this message.
|
java.util.Collection<java.lang.String> |
getTo()
Gets the recipients in the 'to' field of this message.
|
void |
setAmpHtmlBody(java.lang.String ampHtmlBody)
Sets the AMP HTML body of this message.
|
void |
setAttachments(java.util.Collection<MailService.Attachment> attachments)
Sets the attachments of this message.
|
void |
setAttachments(MailService.Attachment... attachments)
Sets the attachments of this message.
|
void |
setBcc(java.util.Collection<java.lang.String> bcc)
Sets the 'bcc' field of this message.
|
void |
setBcc(java.lang.String... bcc)
Sets the 'bcc' field of this message.
|
void |
setCc(java.util.Collection<java.lang.String> cc)
Sets the 'cc' field of this message.
|
void |
setCc(java.lang.String... cc)
Sets the 'cc' field of this message.
|
void |
setHeaders(java.util.Collection<MailService.Header> headers)
Sets the headers of this message.
|
void |
setHeaders(MailService.Header... headers)
Sets the headers of this message.
|
void |
setHtmlBody(java.lang.String htmlBody)
Sets the html body of this message.
|
void |
setReplyTo(java.lang.String replyTo)
replyTo may be null , or must be a valid email
address otherwise. |
void |
setSender(java.lang.String sender)
sender must correspond to the valid email address of one of
the admins for this application, or to the email address of the
currently logged-in user. |
void |
setSubject(java.lang.String subject)
Sets the subject of this message.
|
void |
setTextBody(java.lang.String textBody)
Sets the text body of this message.
|
void |
setTo(java.util.Collection<java.lang.String> to)
Sets the 'to' field of this message.
|
void |
setTo(java.lang.String... to)
Sets the 'to' field of this message.
|
public Message()
public Message(java.lang.String sender, java.lang.String to, java.lang.String subject, java.lang.String textBody)
sender
- The sender's email address.to
- The recipient's email address or null for empty to address.subject
- The message subject.textBody
- The text body of the message.public java.lang.String getSender()
public void setSender(java.lang.String sender)
sender
must correspond to the valid email address of one of
the admins for this application, or to the email address of the
currently logged-in user. Sender is really the From: field of the email.public java.lang.String getReplyTo()
public void setReplyTo(java.lang.String replyTo)
replyTo
may be null
, or must be a valid email
address otherwise.public java.util.Collection<java.lang.String> getTo()
public void setTo(java.util.Collection<java.lang.String> to)
to
- A collection containing the email addresses to set as the 'to'
field.public void setTo(java.lang.String... to)
to
- The email addresses to set as the 'to' field.public java.util.Collection<java.lang.String> getCc()
public void setCc(java.util.Collection<java.lang.String> cc)
cc
- A collection containing the email addresses cc set as the 'cc'
field.public void setCc(java.lang.String... cc)
cc
- The email addresses cc set as the 'cc' field.public java.util.Collection<java.lang.String> getBcc()
public void setBcc(java.util.Collection<java.lang.String> bcc)
bcc
- A collection containing the email addresses bcc set as the
'bcc' field.public void setBcc(java.lang.String... bcc)
bcc
- The email addresses bcc set as the 'bcc' field.public java.lang.String getSubject()
public void setSubject(java.lang.String subject)
subject
- A string containing the new subject of this message.public java.lang.String getTextBody()
public void setTextBody(java.lang.String textBody)
textBody
and
htmlBody
must not be null
.textBody
- A string containing the new text body of this message.public java.lang.String getHtmlBody()
public void setHtmlBody(java.lang.String htmlBody)
textBody
and htmlBody
must not be null
.htmlBody
- A string containing the new html body of this message.public java.lang.String getAmpHtmlBody()
setAmpHtmlBody(java.lang.String)
for more details.public void setAmpHtmlBody(java.lang.String ampHtmlBody)
htmlBody
- A string containing the new AMP HTML body of this message.public java.util.Collection<MailService.Attachment> getAttachments()
public void setAttachments(java.util.Collection<MailService.Attachment> attachments)
attachments
may be
null
, otherwise each attachment must have a corresponding file
name with one of the white-listed extensions.attachments
- A collection of attachments.public void setAttachments(MailService.Attachment... attachments)
attachments
may be
null
, otherwise each attachment must have a corresponding file
name with one of the white-listed extensions.attachments
- Attachments to attach to this message.public java.util.Collection<MailService.Header> getHeaders()
public void setHeaders(java.util.Collection<MailService.Header> headers)
headers
may be null
,
otherwise each header name must be one of the white-listed names.headers
- A collection of headers.public void setHeaders(MailService.Header... headers)
headers
may be null
,
otherwise each header name must be one of the white-listed names.headers
- A collection of headers.