send mail(a,b,c,d,e,f,g[,h,i,j,k,l])
Group |
Sends a mail with subject f and mail message g. If i is defined, the value will be converted to binary data using charset ISO-8859-1 and is attached to the mail. If i is set to <file> the input data - if existent - being processed is attached. In both cases the attachment's filename is Attachment.txt. Optional parameter k can be used to define the attachment name, otherwise, it will be Attachment.txt.
If a hostname or IP address is specified in a, it will be used together with the port h, username c and password d (if set) instead of the default settings of the Integration Server.
b will be used as sender address, e contains a comma-separated list of recipient addresses the mail should be sent to. Alternatively, it is possible to set the internal database ID of a channel of type Mail in parameter e. In that case, all settings of that channel are used and the parameter a to d can be left empty. If these parameters are defined nevertheless, these values will 'overwrite' the channel's settings. The channel needs to be configured with settings for SMTP or ASMTP. CC or BCC recipients may be addressed by cc:xxx or bcc:xxx (where xxx is the mail address).
The return value is true for success or false for error. If sending of the mail fails - and parameter j is false (or empty), the function will finish with an error, otherwise, false is returned.
Description of Parameters
Parameter |
Description |
a |
(optional) Hostname or IP address of the mail server. Default: System default. |
b |
Address of the mail sender. |
c |
(optional) Username to be used for authentication to the mail server. Default: none. |
d |
(optional) Password to be used for authentication to the mail server. Default: none. |
e |
Internal database ID of the channel or a comma-separated list of recipient addresses. Note: You will find the ID in the opened channel. |
f |
Mail subject. |
g |
Mail message. |
h |
(optional) Port of the mail server. Default: 25. |
i |
(optional) Attachment data (as string) or <file> if the processed data should be attached. Note: To attach a file from the file system, the file must first be read in with the function read file( path a[, encoding b] ). Please read in binary files in encoding 8859_1. |
j |
(optional) If set to true, the return value is true or false for the success or fail of operation. If j is false, an exception is thrown for any error. |
k |
(optional) Attachment name. If no value is set, the name will be Attachment.txt. |
l |
(optional) If set to true, an HTML email is created, which means that you can use formatting (such as <b>) in the mail body. |
Examples
Parameter a |
|
|
|
Parameter b |
sender@example.com |
|
newsender@example.org |
Parameter c |
|
|
|
Parameter d |
|
|
|
Parameter e |
rec1@example.org,cc:rec2@example.org |
1234567890 |
1234567890 |
Parameter f |
Infomail |
Infomail |
Infomail |
Parameter g |
Mailtext |
Mailtext |
Mailtext |
Parameter h |
|
|
|
Parameter i |
|
|
<file> |
Parameter j |
true |
true |
true |
Parameter k |
|
|
Order.csv |
Parameter l |
|
|
|
Result |
Sends a mail to the both recipients at example.org with a mail text and without an attachment using the default settings of the Integration Server. |
Sends a mail to the recipient with the address being specified with the channel that is identified by the given database ID. |
Sends a mail containing the input data as attachment to the recipient with the address being specified with the channel that is identified by the given database ID but with a different sender address. The attachment name is Order.csv. |