Interface MailAttachment
public interface MailAttachment
Represent a mail attachment that can be used in a MailMessage.
- Author:
- Alexander Lehmann, Lin Gao
-
Method Summary
Modifier and TypeMethodDescriptionAdd an header to this attachment.static MailAttachmentcreate()construct an empty MailAttachment object that can be filled with the settersstatic MailAttachmentcreate(JsonObject json) create a MailAttachment object from a JsonObject representationstatic MailAttachmentcreate(MailAttachment other) create a copy of a MailAttachment objectget the Content-ID fieldget the Content-TypegetData()get the dataget the description fieldget the disposition fieldGet the headers to be added for this attachment.getName()get the nameintgetSize()Gets the size of the attachment.Gets the data stream.setContentId(String contentId) set the Content-ID field to be used in the attachmentsetContentType(String contentType) set the Content-Typeset the datasetDescription(String description) set the description field to be used in the attachmentsetDisposition(String disposition) set the disposition field to be used in the attachmentsetHeaders(MultiMap headers) Set the headers to be added for this attachment.set the namesetSize(int size) Sets the size of the attachment.setStream(ReadStream<Buffer> stream) Sets the data stream.toJson()convert this object to JSON representation
-
Method Details
-
create
construct an empty MailAttachment object that can be filled with the setters -
create
create a MailAttachment object from a JsonObject representation- Parameters:
json- object to be copied
-
create
create a copy of a MailAttachment object- Parameters:
other- object to be copied
-
getData
-
setData
set the data- Parameters:
data- Buffer of bytes to be used at attachment- Returns:
- this to be able to use it fluently
-
getStream
-
setStream
Sets the data stream.- Parameters:
stream- data stream to be used at attachment- Returns:
- this to be able to use it fluently
-
getSize
int getSize()Gets the size of the attachment.- Returns:
- the size of the attachment
-
setSize
Sets the size of the attachment.It is needed when using ReadStream for the MailAttachement.
- Parameters:
size- the size of the attachment- Returns:
- this to be able to use it fluently
-
getName
-
setName
set the name- Parameters:
name- name of the attachment file- Returns:
- this to be able to use it fluently
name is the descriptive filename that will be put into the mail i.e. usually a local filename without path this can be set to "" to omit the filename attribute
-
getContentType
-
setContentType
set the Content-Type- Parameters:
contentType- the contentType- Returns:
- this to be able to use it fluently
-
getDisposition
-
setDisposition
set the disposition field to be used in the attachment- Parameters:
disposition- the disposition- Returns:
- this to be able to use it fluently
-
getDescription
-
setDescription
set the description field to be used in the attachment- Parameters:
description- the description- Returns:
- this to be able to use it fluently
-
getContentId
-
setContentId
set the Content-ID field to be used in the attachment- Parameters:
contentId- the content id- Returns:
- this to be able to use it fluently
-
addHeader
Add an header to this attachment.- Parameters:
key- the header keyvalue- the header value- Returns:
- a reference to this, so the API can be used fluently
-
getHeaders
-
setHeaders
Set the headers to be added for this attachment.- Parameters:
headers- the headers to be added- Returns:
- this to be able to use it fluently
-
toJson
-