SEND_MAIL

ScriptEigener Objekttyp in der Automation Engine Function: Sends an email to a user.

Syntax

SEND_MAIL(Receiver, [Cc], Subject, Text, [Attachment],[Agent, Login Object] | [_SERVER, _DEFAULT])

Syntax

Description/Format

Receiver

The person that should receive the message.
Format: script literal or script variable

Cc

The person that should receive a copy of this message.
Format: script literal or script variable
Default: ""

Subject

Short description of the message.
Format: script literal or script variable

Text

Message text.
Format: script literal or script variable

Attachment

The path and the name of the files that should be sent as an attachment.
Format: script literal or script variable
Default: ""

Separate the individual paths with a semicolon (;) if you want to send several files.

Agent"Programm, das die Ausführung von Verarbeitungen auf Zielsystemen wie z.B. Rechner oder Geschäftslösungen ermöglicht. Auch ein eigener Objekttyp in der Automation Engine. [Früher ""Executor"" genannt.] Siehe auch ""Host""."

Specifies the agent that should be used to send the email message(s). (optional)

Value:

  • Name of the Agent object or
  • Fixed string "*SERVER" or
  • Fixed string "*DEFAULT" (= default 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 EngineDiese Komponente steuert ein Automation Engine-System. Besteht aus verschiedenen Serverprozessen. system must have the same version.

LoginAnmeldedaten für Zielsysteme. Auch ein eigener Objekttyp in der Automation Engine.

This optional parameter specifies the Login object that is used to send the email message(s). (optional)
It is essential that you have access to files you want to send as attachments.

Value:

  • Name of the Login object

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.
"10034" - There is no active host with email connection.
"50006" - The SMTP server returned an error code.
"50012" - Timeout - SMTP Server '&02' did not answer within '&01' seconds.
"50014" - Attachment does not exist.
"50027" - Authentication on the SMTP Server failed.
"50028" - The receiver address is not valid. Therefore, the SMTP Server has rejected it.
"50029" - The SMTP client cannot connect to the SMTP Server.
"50030" - Error in socket creation.
"50031" - HostRechner, Zielsystem. information of the SMTP Server could not be retrieved.
"50032" - The SMTP client cannot communicate with the SMTP Server anymore.
"50033" - The SMTP client cannot receive data from the SMTP Server.
"50034" - Data cannot be sent to the SMTP Server.
"50035" - Windows sockets cannot be initialized.
"50036" - Host name of the local computer cannot be retrieved.

Comments

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 database.

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.

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

:SEND_MSG

This statement is used to send messages to the user who is logged on to the UserInterfaceVeralteter Begriff. Ersetzt durch: Automic Web Interface.
:ON_ERROR Determines the reaction to certain errors and messages of script elements.

Script Elements - Error Handling and Messages

E-mail connection

Sample Collection:
Retrieving Error Message and Number

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function