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.Mail
public Mail addCc(String... cc)
cc
- the recipients, each item must be a valid email address.Mail
public Mail addTo(String... to)
to
- the recipients, each item must be a valid email address.Mail
public Mail setBcc(List<String> bcc)
bcc
- the list of recipientsMail
public Mail setCc(List<String> cc)
cc
- the list of recipientsMail
public String getFrom()
public Mail setFrom(String from)
quarkus.mailer.from
)from
- the sender addressMail
public String getReplyTo()
public Mail setReplyTo(String replyTo)
replyTo
- the address to use as reply-to. Must be a valid email address.Mail
public String getBounceAddress()
public Mail setBounceAddress(String bounceAddress)
quarkus.mailer.bounceAddress
)bounceAddress
- the bounce address, must be a valid email address.Mail
public String getSubject()
public Mail setSubject(String subject)
subject
- the subjectMail
public String getText()
public Mail setText(String text)
text
- the contentMail
public String getHtml()
public Mail setHtml(String html)
html
- the contentMail
public Mail setTo(List<String> to)
to
- the list of recipientsMail
public Mail addHeader(String key, String... values)
key
- the header name, must not be null
values
- the header values, must not be null
Mail
public Mail removeHeader(String key)
key
- the header name, must not be null
.Mail
public Mail setHeaders(Map<String,List<String>> headers)
headers
- the headersMail
public 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"
.Mail
public 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.Mail
public 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.Mail
public 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.Mail
public 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"
.Mail
public 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"
.Mail
public 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 attachmentMail
public 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 attachmentMail
public List<Attachment> getAttachments()
public Mail setAttachments(List<Attachment> attachments)
attachments
- the attachments.Mail
Copyright © 2019 JBoss by Red Hat. All rights reserved.