SEND_MAIL
Script Function: Sends an email to a user.
Syntax
SEND_MAIL (Receiver, [Cc], Subject, Text[, Attachment][, Agent][, Login])
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. Maximum length: 255 characters |
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 semicolon (;) if you want to send several files. |
Agent |
This optional parameter specifies the agent that should be used to send the email message(s). Value:
If you do not specify an agent here, the default value is applied which means that the system searches for the settings of SEND_MAIL_DEFAULT in the UC_CLIENT_SETTINGS variable. If they do not include any agent specifications, 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 in the UC_CLIENT_SETTINGS). 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). 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. |
Comments
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 function always sends emails either via the specified agent or the Automation Engine. Therefore note that files that should be attached must be accessible via the agent or the Automation Engine either directly or via a UNC path.
The script function causes the current transaction of the script to be written to the AE database.
To send emails, you must have configured the Email connection.
The parameters Agent and Login may also be defined client-wide in the UC_CLIENT_SETTINGS variable, using the key SEND_MAIL_DEFAULT. These settings then will be used if the parameters Agent and Login are not specified in the script function Send_Mail.
Examples
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 Automic Web Interface. | |
: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