new MailMessage()
A mail message
Extends
Methods
(static) testConnection(throwExceptionsopt, testUserNameopt)
Tests the SMTP configuration of the volume
Name | Type | Attributes | Description |
---|---|---|---|
throwExceptions | boolean | <optional> | Control, whether a failing connection test throws its exception. Default: false. |
testUserName | string | <optional> | The name of the user account. Required if the SMTP configuration requires authentication and more than one user is configured. |
attach(attachment)
Attach a entity
Name | Type | Description |
---|---|---|
attachment | $k.NetEntity |
- Inherited From
If the entity is not a valid attachment
attachments() → {Array.<$k.NetEntity>}
Returns the attached entities
- Inherited From
- Type:
- Array.<$k.NetEntity>
base64String() → {string}
Get the binay contents as base64-encoded string. Returns undefined if the contents is not binary
- Inherited From
- Type:
- string
bcc() → {Array.<string>}
Get the blind carbon copy receivers ('bcc' field)
- Type:
- Array.<string>
cc() → {Array.<string>}
Get the carbon copy receivers ('cc' field)
- Type:
- Array.<string>
charset() → {string}
Returns the charset
- Inherited From
- Type:
- string
contentDisposition() → {string}
Returns the content disposition
- Inherited From
- Type:
- string
contentLength() → {number}
Returns the content length
- Inherited From
- Type:
- number
contentType() → {string}
Returns the content type (only the media type part)
- Inherited From
- Type:
- string
dataUrl() → {string}
Returns the entity bytes as a data URL, or undefined if the entity is not binary
- Inherited From
- Type:
- string
date() → {Array.<date>}
Get the date ('date' field)
- Since
- 5.4.2
- Type:
- Array.<date>
debugString() → {string}
Prints the entity, except binary contents, for debugging purposes
- Inherited From
- Type:
- string
filename() → {string}
Returns the filename part of the content disposition field
- Inherited From
- Type:
- string
formData() → {object}
Get all form fields (multipart/form-data or application/x-www-form-urlencoded). The property names correspond to the field names. The property values are either strings (if the form is of type application/x-www-form-urlencoded) or NetEntities (multipart/form-data)
- Inherited From
- See
- Type:
- object
headerCharset()
Get the charset of the headers
headerField(fieldName) → {string}
Get the value of the field of the request header. Returns undefined if the field does not exist
Name | Type | Description |
---|---|---|
fieldName | string |
- Inherited From
The field value
- Type:
- string
headerFields() → {object}
Get all fields of the request header. Field names are always lower case
- Inherited From
- Type:
- object
isBinary() → {boolean}
True if the entity has binary contents
- Inherited From
- Type:
- boolean
receiver() → {Array.<string>}
Get the receiver ('to' field)
- Type:
- Array.<string>
removeHeaderField(fieldName)
Removes the field of the request heade
Name | Type | Description |
---|---|---|
fieldName | string |
- Since
- 5.0.3
- Inherited From
send(asyncopt)
Send the mail, using the SMTP configuration of the volume
Name | Type | Attributes | Description |
---|---|---|---|
async | boolean | <optional> | True if the mail should be sent asynchronously, false if send() should block until the mail has been sent. Default is true. |
sender() → {Array.<string>}
Get the sender
- Type:
- Array.<string>
setBcc(receivers)
Set the blind carbon copy receivers ('bcc' field)
Name | Type | Description |
---|---|---|
receivers | String or Array of strings |
setCc(receivers)
Set the carbon copy receivers ('cc' field)
Name | Type | Description |
---|---|---|
receivers | String or Array of strings |
setCharset(charset)
Set the charset
Name | Type | Description |
---|---|---|
charset | string |
- Inherited From
If the charset is unknown
setContentDisposition(contentDisposition)
Set the content disposition
Name | Type | Description |
---|---|---|
contentDisposition | string |
- Inherited From
setContentLength(length)
Set the content length
Name | Type | Description |
---|---|---|
length | number |
- Inherited From
setContents(contents)
Set the contents of the entity. Also sets the content type and filename if known. The contents object can be a string, document ($k.TextDocument), a blob value ($k.Blob) or another NetEntity
Name | Type | Description |
---|---|---|
contents | Contents object |
- Inherited From
setContentType(mediaType, charsetopt)
Set the content type
Name | Type | Attributes | Description |
---|---|---|---|
mediaType | string | Media type of the contents | |
charset | string | <optional> | Charset of the contents |
- Inherited From
setDate(date)
Set the date ('date' field)
Name | Type | Description |
---|---|---|
date | Date (either as a date or a string) |
- Since
- 5.4.2
setFilename(filename)
Set the filename part of the content disposition field
Name | Type | Description |
---|---|---|
filename | string |
- Inherited From
setHeaderCharset(charset)
Set the charset of the headers
Name | Type | Description |
---|---|---|
charset | string | Charset (encoding) of the headers |
If the charset is unknown
setHeaderField(fieldName, fieldValue)
Set the value of the field of the request header
Name | Type | Description |
---|---|---|
fieldName | string | |
fieldValue |
- Inherited From
If the value does not match the type of the field
setReceiver(receivers)
Set the receiver ('to' field)
Name | Type | Description |
---|---|---|
receivers | String or Array of strings |
If the value is not a valid receiver
setSender(sender)
Set the sender ('from' field)
Name | Type | Description |
---|---|---|
sender | string |
If the value is not a valid sender
Sender value must be strings
setSubject(subject)
Set the subject
Name | Type | Description |
---|---|---|
subject | string |
If the value is not a valid subject
setText(text)
Set the text as the body
Name | Type | Description |
---|---|---|
text | string |
- Inherited From
setUserName(username)
Set the name of the user account. Required if the SMTP configuration requires authentication and more than one user is configured
Name | Type | Description |
---|---|---|
username | string |
subject() → {string}
Get the subject
- Type:
- string
text(charsetopt) → {string}
Get the contents as string
Name | Type | Attributes | Description |
---|---|---|---|
charset | string | <optional> | Charset of the characters. Required for binary entities. Optional for text entities. |
- Inherited From
- Type:
- string
userName() → {string}
Get the name of the user account
- Type:
- string