public class Mail extends Object
Instances are NOT thread-safe.
| Modifier and Type | Method and Description |
|---|---|
Mail |
addAttachment(String name,
byte[] data,
String contentType)
Adds an attachment.
|
Mail |
addAttachment(String name,
byte[] data,
String contentType,
String description,
String disposition)
Adds an attachment.
|
Mail |
addAttachment(String name,
File file,
String contentType)
Adds an attachment.
|
Mail |
addAttachment(String name,
org.reactivestreams.Publisher<Byte> data,
String contentType)
Adds an attachment.
|
Mail |
addAttachment(String name,
org.reactivestreams.Publisher<Byte> data,
String contentType,
String description,
String disposition)
Adds an attachment.
|
Mail |
addBcc(String... bcc)
Adds BCC recipients.
|
Mail |
addCc(String... cc)
Adds CC recipients.
|
Mail |
addHeader(String key,
String... values)
Adds a header value.
|
Mail |
addInlineAttachment(String name,
byte[] data,
String contentType,
String contentId)
Adds an inline attachment.
|
Mail |
addInlineAttachment(String name,
File file,
String contentType,
String contentId)
Adds an inline attachment.
|
Mail |
addInlineAttachment(String name,
org.reactivestreams.Publisher<Byte> data,
String contentType,
String contentId)
Adds an inline attachment.
|
Mail |
addTo(String... to)
Adds TO recipients.
|
List<Attachment> |
getAttachments() |
List<String> |
getBcc() |
String |
getBounceAddress() |
List<String> |
getCc() |
String |
getFrom() |
Map<String,List<String>> |
getHeaders() |
String |
getHtml() |
String |
getReplyTo() |
String |
getSubject() |
String |
getText() |
List<String> |
getTo() |
Mail |
removeHeader(String key)
Removes a header.
|
Mail |
setAttachments(List<Attachment> attachments)
Sets the attachment list.
|
Mail |
setBcc(List<String> bcc)
Sets the BCC recipients.
|
Mail |
setBounceAddress(String bounceAddress)
Sets the bounce address.
|
Mail |
setCc(List<String> cc)
Sets the CC recipients.
|
Mail |
setFrom(String from)
Sets the sender address.
|
Mail |
setHeaders(Map<String,List<String>> headers)
Sets the list of headers.
|
Mail |
setHtml(String html)
Sets the body of the email as HTML.
|
Mail |
setReplyTo(String replyTo)
Sets the reply-to address.
|
Mail |
setSubject(String subject)
Sets the email subject.
|
Mail |
setText(String text)
Sets the body of the email as plain text.
|
Mail |
setTo(List<String> to)
Sets the TO recipients.
|
static Mail |
withHtml(String to,
String subject,
String html)
Creates a new instance of
Mail that contains a "html" body. |
static Mail |
withText(String to,
String subject,
String text)
Creates a new instance of
Mail that contains a "text" body. |
public Mail()
Mail.public static Mail withText(String to, String subject, String text)
Mail that contains a "text" body.
The returned instance can be modified.to - the address of the recipientsubject - the subjecttext - the bodyMail instance.public static Mail withHtml(String to, String subject, String html)
Mail that contains a "html" body.
The returned instance can be modified.to - the address of the recipientsubject - the subjecthtml - the bodyMail instance.public Mail addBcc(String... bcc)
bcc - the recipients, each item must be a valid email address.Mailpublic Mail addCc(String... cc)
cc - the recipients, each item must be a valid email address.Mailpublic Mail addTo(String... to)
to - the recipients, each item must be a valid email address.Mailpublic Mail setBcc(List<String> bcc)
bcc - the list of recipientsMailpublic Mail setCc(List<String> cc)
cc - the list of recipientsMailpublic String getFrom()
public Mail setFrom(String from)
quarkus.mailer.from )from - the sender addressMailpublic String getReplyTo()
public Mail setReplyTo(String replyTo)
replyTo - the address to use as reply-to. Must be a valid email address.Mailpublic String getBounceAddress()
public Mail setBounceAddress(String bounceAddress)
quarkus.mailer.bounceAddress )bounceAddress - the bounce address, must be a valid email address.Mailpublic String getSubject()
public Mail setSubject(String subject)
subject - the subjectMailpublic String getText()
public Mail setText(String text)
text - the contentMailpublic String getHtml()
public Mail setHtml(String html)
html - the contentMailpublic Mail setTo(List<String> to)
to - the list of recipientsMailpublic Mail addHeader(String key, String... values)
key - the header name, must not be nullvalues - the header values, must not be nullMailpublic Mail removeHeader(String key)
key - the header name, must not be null.Mailpublic Mail setHeaders(Map<String,List<String>> headers)
headers - the headersMailpublic Mail addInlineAttachment(String name, File file, String contentType, String contentId)
name - the name of the attachment, generally a file name.file - the file to be attached. Note that the file will be read asynchronously.contentType - the content typecontentId - the content id. It must follows the <some-id@some-domain> syntax. Then the HTML
content can reference this attachment using src="cid:some-id@some-domain".Mailpublic Mail addAttachment(String name, File file, String contentType)
name - the name of the attachment, generally a file name.file - the file to be attached. Note that the file will be read asynchronously.contentType - the content type.Mailpublic Mail addAttachment(String name, byte[] data, String contentType)
name - the name of the attachment, generally a file name.data - the binary data to be attachedcontentType - the content type.Mailpublic Mail addAttachment(String name, org.reactivestreams.Publisher<Byte> data, String contentType)
name - the name of the attachment, generally a file name.data - the binary data to be attachedcontentType - the content type.Mailpublic Mail addInlineAttachment(String name, byte[] data, String contentType, String contentId)
name - the name of the attachment, generally a file name.data - the binary data to be attachedcontentType - the content typecontentId - the content id. It must follows the <some-id@some-domain> syntax. Then the HTML
content can reference this attachment using src="cid:some-id@some-domain".Mailpublic Mail addInlineAttachment(String name, org.reactivestreams.Publisher<Byte> data, String contentType, String contentId)
name - the name of the attachment, generally a file name.data - the binary data to be attachedcontentType - the content typecontentId - the content id. It must follows the <some-id@some-domain> syntax. Then the HTML
content can reference this attachment using src="cid:some-id@some-domain".Mailpublic Mail addAttachment(String name, byte[] data, String contentType, String description, String disposition)
name - the name of the attachment, generally a file name.data - the binary data to be attachedcontentType - the content typedescription - the description of the attachmentdisposition - the disposition of the attachmentMailpublic Mail addAttachment(String name, org.reactivestreams.Publisher<Byte> data, String contentType, String description, String disposition)
name - the name of the attachment, generally a file name.data - the binary data to be attachedcontentType - the content typedescription - the description of the attachmentdisposition - the disposition of the attachmentMailpublic List<Attachment> getAttachments()
public Mail setAttachments(List<Attachment> attachments)
attachments - the attachments.MailCopyright © 2020 JBoss by Red Hat. All rights reserved.