Script Function: Sends an email to a user.
SEND_MAIL(Receiver, [Cc], Subject, Text, [Attachment],[Agent, Login Object] | [_SERVER, _DEFAULT])
Syntax |
Description/Format |
---|---|
Receiver |
The person that should receive the message. |
Cc |
The person that should receive a copy of this message. |
Subject |
Short description of the message. |
Text |
Message text. |
Attachment |
The path and the name of the files that should be sent as an attachment. Separate the individual paths with a comma (,) if you want to send several files. |
Agent |
Specifies the agent that should be used to send the email message(s). (optional) Value:
If you don't specify an agent, the email is sent by the AE/server The value "*SERVER" can be used to force sending the email via the AE/server (even if you set a central Agent/login). For the value "*DEFAULT", the UC_CLIENT_SETTINGS values are used. The specified agent and the Automation Engine system must have the same version. |
Login |
This optional parameter specifies the Login object that is used to send the email message(s). (optional) Value:
This parameter is ignored, if the parameter Agent is set to "*SERVER" (no Login object needed). It is mandatory, if you specified the Agent parameter. |
Return codes |
---|
"0" - Email
was sent successfully. |
The sending of emails depends on the user's PC configurations.
This script function does not check whether the specified Receiver actually exists. The message is sent even if the receiver is not correct.
When the email cannot be sent because the attachment cannot be found or the email connection is not active, script processing continues by default. In this case, the script function returns the corresponding return code.
You can use the script statement :ON_ERROR to cancel script processing if an error occurs. To analyze the error, you use the script functions for error handling.
This script element always sends emails via the Automation Engine. Files that should be attached must be stored on the computer of the AutomationEngine or be accessible from there (UNC path).
Tthe number of characters is limited to 1024 characters per line.
The script function causes all open transactions of the script to be written to the AE databaseA database is an organized collection of data including relevant data structures..
To send emails, you must have configured the E-mail connection.
The parameters Agent and Login may also be defined client-wide in the UC_CLIENT_SETTINGS variable, using the key SEND_MAIL_DEFAULT. Settings in individual SEND_MAIL script functions will be overridden by the key in UC_CLIENT_SETTINGS anywhere throughout the respective client.
In the following example, an email is sent only to one user (no copies). One file is attached to this email.
:SET &OUT# = SEND_MAIL('brown@automic.at',,'Meeting','Meeting today at 5pm', '/AE/agenda')
An email that includes two attachments is sent to several persons:
:SET &OUT# = SEND_MAIL("brown@automic.at;smith@automic.us",,"Meeting","Meeting canceled","c:\AUTOMIC\agenda.doc;c:\AUTOMIC\dates.txt")
See also:
Script element | Description |
---|---|
This statement is used to send messages to the user who is logged on to the UserInterface. | |
:ON_ERROR | Determines the reaction to certain errors and messages of script elements. |
Script Elements - Error Handling and Messages
Sample Collection:
Retrieving Error Message and Number
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function