Package com.google.appengine.api.mail
Class MailService.Message
java.lang.Object
com.google.appengine.api.mail.MailService.Message
- Enclosing interface:
MailService
Messages are prepared by the caller, and then submitted to the Mail service
for sending. Different fields are subject to different constraints, as
enumerated in the
send
and sendToAdmins
methods.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the AMP HTML body of this message.Gets the attachments of this message.getBcc()
Gets the recipients in the 'bcc' field of this message.getCc()
Gets the recipients in the 'cc' field of this message.Gets the headers of this message.Gets the html body of this message.Gets the reply to field of this message.Gets the sender of this message.Gets the subject of this message.Gets the text body of this message.getTo()
Gets the recipients in the 'to' field of this message.void
setAmpHtmlBody
(String ampHtmlBody) Sets the AMP HTML body of this message.void
setAttachments
(MailService.Attachment... attachments) Sets the attachments of this message.void
setAttachments
(Collection<MailService.Attachment> attachments) Sets the attachments of this message.void
Sets the 'bcc' field of this message.void
setBcc
(Collection<String> bcc) Sets the 'bcc' field of this message.void
Sets the 'cc' field of this message.void
setCc
(Collection<String> cc) Sets the 'cc' field of this message.void
setHeaders
(MailService.Header... headers) Sets the headers of this message.void
setHeaders
(Collection<MailService.Header> headers) Sets the headers of this message.void
setHtmlBody
(String htmlBody) Sets the html body of this message.void
setReplyTo
(String replyTo) replyTo
may benull
, or must be a valid email address otherwise.void
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
(String subject) Sets the subject of this message.void
setTextBody
(String textBody) Sets the text body of this message.void
Sets the 'to' field of this message.void
setTo
(Collection<String> to) Sets the 'to' field of this message.
-
Constructor Details
-
Message
public Message() -
Message
Convenience constructor for simple messages- Parameters:
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.
-
-
Method Details
-
getSender
Gets the sender of this message.- Returns:
- The sender of this message.
-
setSender
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. -
getReplyTo
Gets the reply to field of this message.- Returns:
- The reply to field of this message.
-
setReplyTo
replyTo
may benull
, or must be a valid email address otherwise. -
getTo
Gets the recipients in the 'to' field of this message.- Returns:
- A collection containing the 'to' field recipients.
-
setTo
Sets the 'to' field of this message. Each string in the collection represents exactly one email address. Having null (or invalid addresses) will lead to eventual failure during the send process.- Parameters:
to
- A collection containing the email addresses to set as the 'to' field.
-
setTo
Sets the 'to' field of this message. Each string represents exactly one email address. Having null (or invalid addresses) will lead to eventual failure during the send process.- Parameters:
to
- The email addresses to set as the 'to' field.
-
getCc
Gets the recipients in the 'cc' field of this message.- Returns:
- A collection containing the 'cc' field recipients.
-
setCc
Sets the 'cc' field of this message. Each string in the collection represents exactly one email address. Having null (or invalid addresses) will lead cc eventual failure during the send process.- Parameters:
cc
- A collection containing the email addresses cc set as the 'cc' field.
-
setCc
Sets the 'cc' field of this message. Each string represents exactly one email address. Having null (or invalid addresses) will lead cc eventual failure during the send process.- Parameters:
cc
- The email addresses cc set as the 'cc' field.
-
getBcc
Gets the recipients in the 'bcc' field of this message.- Returns:
- A collection containing the 'bcc' field recipients.
-
setBcc
Sets the 'bcc' field of this message. Each string in the collection represents exactly one email address. Having null (or invalid addresses) will lead bcc eventual failure during the send process.- Parameters:
bcc
- A collection containing the email addresses bcc set as the 'bcc' field.
-
setBcc
Sets the 'bcc' field of this message. Each string represents exactly one email address. Having null (or invalid addresses) will lead bcc eventual failure during the send process.- Parameters:
bcc
- The email addresses bcc set as the 'bcc' field.
-
getSubject
Gets the subject of this message.- Returns:
- The subject of this message.
-
setSubject
Sets the subject of this message. A null or empty subject will lead to eventual failure during the send process.- Parameters:
subject
- A string containing the new subject of this message.
-
getTextBody
Gets the text body of this message.- Returns:
- The text body.
-
setTextBody
Sets the text body of this message. At least one oftextBody
andhtmlBody
must not benull
.- Parameters:
textBody
- A string containing the new text body of this message.
-
getHtmlBody
Gets the html body of this message.- Returns:
- The html body.
-
setHtmlBody
Sets the html body of this message. At least one oftextBody
andhtmlBody
must not benull
.- Parameters:
htmlBody
- A string containing the new html body of this message.
-
getAmpHtmlBody
Gets the AMP HTML body of this message. SeesetAmpHtmlBody(java.lang.String)
for more details.- Returns:
- The AMP HTML body.
-
setAmpHtmlBody
Sets the AMP HTML body of this message. This field is optional. Setting AMP HTML body makes the email an AMP Email. Plain text or HTML may become fallback content depending on the email client used.- Parameters:
ampHtmlBody
- A string containing the new AMP HTML body of this message.
-
getAttachments
Gets the attachments of this message.- Returns:
- A collection containing the attachments of this message.
-
setAttachments
Sets the attachments of this message.attachments
may benull
, otherwise each attachment must have a corresponding file name with an extension not on the block list.- Parameters:
attachments
- A collection of attachments.
-
setAttachments
Sets the attachments of this message.attachments
may benull
, otherwise each attachment must have a corresponding file name with an extension not on the block list.- Parameters:
attachments
- Attachments to attach to this message.
-
getHeaders
Gets the headers of this message.- Returns:
- A collection containing the headers of this message.
-
setHeaders
Sets the headers of this message.headers
may benull
, otherwise each header name must be one of the allowed names.- Parameters:
headers
- A collection of headers.
-
setHeaders
Sets the headers of this message.headers
may benull
, otherwise each header name must be one of the allowed names.- Parameters:
headers
- A collection of headers.
-