Package io.vertx.ext.mail
Class MailMessage
- java.lang.Object
-
- io.vertx.ext.mail.MailMessage
-
public class MailMessage extends Object
represent a mail message that can be sent via the MailClient- Author:
- Alexander Lehmann
-
-
Constructor Summary
Constructors Constructor Description MailMessage()
construct empty mail message that can be used with the settersMailMessage(JsonObject json)
construct object from a JsonObject representationMailMessage(MailMessage other)
copy object to another @link MailMessage objectMailMessage(String from, String to, String subject, String text)
construct a simple message with text/plain
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MailMessage
addHeader(String key, String value)
Add a message header.boolean
equals(Object o)
List<MailAttachment>
getAttachment()
get the list of attachments of this mailList<String>
getBcc()
get list of bcc addressesString
getBounceAddress()
get bounce address of this mailList<String>
getCc()
get list of cc addressesString
getFrom()
get from address of this mailMultiMap
getHeaders()
Get the headers.String
getHtml()
get the html text of this mailList<MailAttachment>
getInlineAttachment()
get the list of inline attachments of this mailString
getSubject()
get the subject of this mailString
getText()
get the plain text of this mailList<String>
getTo()
get list of to addressesint
hashCode()
boolean
isFixedHeaders()
get whether our own headers should be the only headers added to the messageMailMessage
setAttachment(MailAttachment attachment)
set a single attachment of this mailMailMessage
setAttachment(List<MailAttachment> attachment)
set the list of attachments of this mailMailMessage
setBcc(String bcc)
helper method for single recipientMailMessage
setBcc(List<String> bcc)
set list of bcc addressesMailMessage
setBounceAddress(String bounceAddress)
set bounce address of this mailMailMessage
setCc(String cc)
helper method for single recipientMailMessage
setCc(List<String> cc)
set list of cc addressesMailMessage
setFixedHeaders(boolean fixedHeaders)
set whether our own headers should be the only headers added to the messageMailMessage
setFrom(String from)
set from address of this mailMailMessage
setHeaders(MultiMap headers)
Set the headers.MailMessage
setHtml(String html)
set the html text of this mailMailMessage
setInlineAttachment(MailAttachment inlineAttachment)
set a single inline attachment of this mailMailMessage
setInlineAttachment(List<MailAttachment> inlineAttachment)
set the list of inline attachments of this mailMailMessage
setSubject(String subject)
set the subject of this mailMailMessage
setText(String text)
set the plain text of this mailMailMessage
setTo(String to)
helper method for single recipientMailMessage
setTo(List<String> to)
set list of to addressesJsonObject
toJson()
convert the mail message to Json representation
-
-
-
Constructor Detail
-
MailMessage
public MailMessage()
construct empty mail message that can be used with the setters
-
MailMessage
public MailMessage(MailMessage other)
copy object to another @link MailMessage object- Parameters:
other
- object to copy
-
MailMessage
public MailMessage(JsonObject json)
construct object from a JsonObject representation- Parameters:
json
- json object to copy
-
-
Method Detail
-
getBounceAddress
public String getBounceAddress()
get bounce address of this mail- Returns:
- bounce address
-
setBounceAddress
public MailMessage setBounceAddress(String bounceAddress)
set bounce address of this mail- Parameters:
bounceAddress
- bounce address- Returns:
- this to be able to use it fluently
-
getFrom
public String getFrom()
get from address of this mail- Returns:
- from address
-
setFrom
public MailMessage setFrom(String from)
set from address of this mail- Parameters:
from
- from addrss- Returns:
- this to be able to use it fluently
-
setTo
public MailMessage setTo(List<String> to)
set list of to addresses- Parameters:
to
- List of to addresses- Returns:
- this to be able to use it fluently
-
setTo
public MailMessage setTo(String to)
helper method for single recipient- Parameters:
to
- to address- Returns:
- this to be able to use it fluently
-
setCc
public MailMessage setCc(List<String> cc)
set list of cc addresses- Parameters:
cc
- List of cc addresses- Returns:
- this to be able to use it fluently
-
setCc
public MailMessage setCc(String cc)
helper method for single recipient- Parameters:
cc
- cc address- Returns:
- this to be able to use it fluently
-
setBcc
public MailMessage setBcc(List<String> bcc)
set list of bcc addresses- Parameters:
bcc
- List of bcc addresses- Returns:
- this to be able to use it fluently
-
setBcc
public MailMessage setBcc(String bcc)
helper method for single recipient- Parameters:
bcc
- bcc address- Returns:
- this to be able to use it fluently
-
getSubject
public String getSubject()
get the subject of this mail- Returns:
- the subject
-
setSubject
public MailMessage setSubject(String subject)
set the subject of this mail- Parameters:
subject
- the subject- Returns:
- this to be able to use it fluently
-
getText
public String getText()
get the plain text of this mail- Returns:
- the text
-
setText
public MailMessage setText(String text)
set the plain text of this mail- Parameters:
text
- the text- Returns:
- this to be able to use it fluently
-
getHtml
public String getHtml()
get the html text of this mail- Returns:
- the text
-
setHtml
public MailMessage setHtml(String html)
set the html text of this mail- Parameters:
html
- the text- Returns:
- this to be able to use it fluently
-
getAttachment
public List<MailAttachment> getAttachment()
get the list of attachments of this mail- Returns:
- List of attachment
-
setAttachment
public MailMessage setAttachment(List<MailAttachment> attachment)
set the list of attachments of this mail- Parameters:
attachment
- List of attachment- Returns:
- this to be able to use it fluently
-
setAttachment
public MailMessage setAttachment(MailAttachment attachment)
set a single attachment of this mail- Parameters:
attachment
- the attachment to add- Returns:
- this to be able to use it fluently
-
getInlineAttachment
public List<MailAttachment> getInlineAttachment()
get the list of inline attachments of this mail- Returns:
- List of attachment
-
setInlineAttachment
public MailMessage setInlineAttachment(List<MailAttachment> inlineAttachment)
set the list of inline attachments of this mail- Parameters:
inlineAttachment
- List of attachment- Returns:
- this to be able to use it fluently
-
setInlineAttachment
public MailMessage setInlineAttachment(MailAttachment inlineAttachment)
set a single inline attachment of this mail- Parameters:
inlineAttachment
- the attachment to add- Returns:
- this to be able to use it fluently
-
addHeader
public MailMessage addHeader(String key, String value)
Add a message header.- Parameters:
key
- the header keyvalue
- the header value- Returns:
- a reference to this, so the API can be used fluently
-
getHeaders
public MultiMap getHeaders()
Get the headers.- Returns:
- the headers
-
setHeaders
public MailMessage setHeaders(MultiMap headers)
Set the headers.- Parameters:
headers
- the headers to set- Returns:
- this to be able to use it fluently
-
isFixedHeaders
public boolean isFixedHeaders()
get whether our own headers should be the only headers added to the message- Returns:
- the fixedHeaders
-
setFixedHeaders
public MailMessage setFixedHeaders(boolean fixedHeaders)
set whether our own headers should be the only headers added to the message- Parameters:
fixedHeaders
- the fixedHeaders to set- Returns:
- this to be able to use it fluently
-
toJson
public JsonObject toJson()
convert the mail message to Json representation- Returns:
- the json object
-
-