new MailAttachment()
Represent a mail attachment that can be used in a MailMessage.
- Source:
Methods
addHeader(key, value) → {MailAttachment}
Add an header to this attachment.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | the header key |
value |
string | the header value |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- MailAttachment
getContentId() → {string}
get the Content-ID field
- Source:
Returns:
the content id
- Type
- string
getContentType() → {string}
get the Content-Type
- Source:
Returns:
the contentType
- Type
- string
getData() → {Buffer}
get the data
- Source:
Returns:
the data
- Type
- Buffer
getDescription() → {string}
get the description field
- Source:
Returns:
the description
- Type
- string
getDisposition() → {string}
get the disposition field
- Source:
Returns:
the disposition
- Type
- string
getHeaders() → {MultiMap}
Get the headers to be added for this attachment.
- Source:
Returns:
the headers
- Type
- MultiMap
getName() → {string}
get the name
- Source:
Returns:
the name
- Type
- string
setContentId(contentId) → {MailAttachment}
set the Content-ID field to be used in the attachment
Parameters:
| Name | Type | Description |
|---|---|---|
contentId |
string | the content id |
- Source:
Returns:
this to be able to use it fluently
- Type
- MailAttachment
setContentType(contentType) → {MailAttachment}
set the Content-Type
Parameters:
| Name | Type | Description |
|---|---|---|
contentType |
string | the contentType |
- Source:
Returns:
this to be able to use it fluently
- Type
- MailAttachment
setData(data) → {MailAttachment}
set the data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Buffer | Buffer of bytes to be used at attachment |
- Source:
Returns:
this to be able to use it fluently
- Type
- MailAttachment
setDescription(description) → {MailAttachment}
set the description field to be used in the attachment
Parameters:
| Name | Type | Description |
|---|---|---|
description |
string | the description |
- Source:
Returns:
this to be able to use it fluently
- Type
- MailAttachment
setDisposition(disposition) → {MailAttachment}
set the disposition field to be used in the attachment
Parameters:
| Name | Type | Description |
|---|---|---|
disposition |
string | the disposition |
- Source:
Returns:
this to be able to use it fluently
- Type
- MailAttachment
setHeaders(headers) → {MailAttachment}
Set the headers to be added for this attachment.
Parameters:
| Name | Type | Description |
|---|---|---|
headers |
MultiMap | the headers to be added |
- Source:
Returns:
this to be able to use it fluently
- Type
- MailAttachment
setName(name) → {MailAttachment}
set the name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | name of the attachment file |
- Source:
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
- Type
- MailAttachment
toJson() → {Object}
convert this object to JSON representation
- Source:
Returns:
the JSON object
- Type
- Object