Documentation

Send Mail Triggered

Send e-mail - FUPLA

Block name

SENDMAILTRIG

ST call

It is better to use the sendmail block for ST programs.

Library

MESSAGING

Version

V1.0

Description

The function sends an e-mail at each transition of the control variable send from FALSE to TRUE. If You want to send more than one email at the time, You have to use this block multiple times or create some sort of switcher for addresses. PLC is capable of sending one email at the certain moment, so more emails needs to be sent with gaps. The gap between emails should be at least 1 second, but ideally even more.  

Inputs

Input Type Description
CHANNEL STRING communication connection definition (set in PLC properties, see below)
FROM STRING e-mail address from which the mail is sent
RECIPIENT STRING recipient's e-mail address
SUBJECT STRING e-mail subject
MESSAGE STRING e-mail body text
SEND BOOL command to send the e-mail

Outputs

Output Type Description
RESULT SINT Numeric status; result of the system settings check

Function

Each rising edge on the send input sends an e-mail from the predefined from e-mail account to the recipient address. The e-mail subject is taken from the subject variable, and the e-mail body from the message variable.

The channel variable refers to the predefined communication channel. This has to be created in the PLC properties: doubleclick the PLC and select Message definition, then right-click the context menu and Add alarm channel.

Now, define the channel name which is the value of the channel variable. Then, the SMTP connection type must be defined: click to select the channel and set the SMTP server to be used for e-mail sending, and TCP port which the server uses for communication. If the server requires login, set Use login to true and then fill in the User name (most probably the e-mail address) and Password. Finally, confirm all changes by clicking OK in the red dialogue.

Note that the SMTP server must be accessible by the PLC: check default gateway settings, DNS server etc.

The output variable result indicates the result of the system settings check.

Value Description
0 OK
8 E-mail queue full
16 Unknown channel
24 Error - impossible to determine the status
other Internal error - contact Domat Control System support

 

Application example

This function is typically used to send alarm messages. The sending of an e-mail is launched by the alarm status appearance. Another e-mail is sent whe the alarm is reset and launched again. Alarm is active as soon as the teplota variable goes over the teplotni_limit value.