Package: mailer
Send and receive mail APIs.
- 1 Types
- 1.1 emailserveroutgoing
- 1.2 emailserverincoming
- 1.3 emailin
- 1.4 emailout
- 2 API
- 2.1 send
- 2.2 addAttachment
- 2.3 receive
- 2.4 downloadAttachments
Since 1.5.2
Types
emailserveroutgoing
Property | Type | Default value | Description |
---|---|---|---|
host | string | The host name (or IP) of the email server. | |
port | string | 25 | The port of the email server. |
user | string | The user to authenticate with the email server. | |
password | string | The password to authenticate with the email server. | |
protocol | string | One of | |
debug | boolean | false | True if the interactions with this server should be logged into the |
debugLog | collection of string | The debug log for this session. The collection will hold only the last 1024 messages. The log is not persistent and is only valid for this session. | |
startTLS | boolean | false | |
properties | string | Comma (,) separated properties with their values. |
emailserverincoming
Property | Type | Default value | Description |
---|---|---|---|
host | string | The host name (or IP) of the email server. | |
port | string | 993 | The port of the email server. |
user | string | The user to authenticate with the email server. | |
password | string | The password to authenticate with the email server. | |
protocol | string | One of | |
folderName | string | The folder for which messages are read. | |
debug | boolean | false | True if the interactions with this server should be logged into the |
debugLog | collection of string | The debug log for this session. The collection will hold only the last 1024 messages. The log is not persistent and is only valid for this session. | |
properties | string | Comma (,) separated properties with their values. | |
convertToUTF3B | boolean | true | Convert the received string tu UTF in 3 bytes format (for MySQL UTF8 compatibility). |
maxMessages | int | 16 | Max messages to retrieve from the server |
downloadAttachments | boolean | false | Download attachments in the receive function? |
emailin
Property | Type | Description |
---|---|---|
uid | string | The unique id of the message. The id is unique only to this mail server folder and not globally. Message UIDs start at 0 (zero). |
from | string | The sender email address. |
fromName | string | The sender full name. |
to | string | The receiver email address. |
toName | string | The receiver full name. |
subject | string | The subject. |
content | string | The message content in the original format (html, text etc.) |
date | datetime | The date the message was received. |
hasAttachments | boolean | If the message has any attachments this field will be true. |
attachments | collection of int | Storage ids of files that have been downloaded.if emailserverincoming.downloadAttachments is true. |
emailout
Property | Type | Description |
---|---|---|
from | string | The sender email address. |
fromName | string | The sender full name. |
to | string | The receiver email address. |
toName | string | The receiver full name. |
subject | string | The subject. |
content | string | The message content in the original format (html, text etc.) |
date | datetime | The date the message was send/received?? |
hasAttachments | boolean | If the message has any attachments this field will be true. |
attachments | collection of int | The storage ids of files to attach to the email. |
API
send
function send(emailServer as emailserveroutgoing, emailOut as emailout) as bool
Send message. Returns true
if the message was sent or false
otherwise.
Since 1.5.2
addAttachment
method addAttachment(emailOut as emailout, storageFileKey as int)
Attach the file from storage to emailOut.
Since 1.5.2
receive
function receive(emailServer as emailserveringoing, startUID as int, lastUID as int) as list of emailin
Receive messages starting with startUID
up to lastUID
. When receiving messages the application should keep track of the UIDs.
The
startUID
can benull
. IfstartUID
isnull
then you will receive the messages starting with the first available message on the server.The
lastUID
can benull
. IflastUID
isnull
then all the available messages starting withstartUID
are returned.
Since 1.5.2
downloadAttachments
function downloadAttachments(emailServer as emailserveringoing, messageUID as int) as collection of int
Downloads file attachments to storage from specified messageUID, returns the storage file ids of stored files.
Since 1.5.2