Send e-mail - FUPLA

SENDMAILTRIG

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

MESSAGING

V1.0

The function sends an e-mail at each transition of the control variable send from FALSE to TRUE. If more than one email has to be sent at a time, this block must be used multiple times or a sort of switcher for addresses must be created. PLC is capable of sending one email at a moment only, so more emails need to be sent with time gaps. The gap between emails should be at least 1 second, but ideally even more.  

Input Type Description
CHANNEL STRINGcommunication connection definition (set in PLC properties, see below)
FROM STRINGe-mail address from which the mail is sent
RECIPIENTSTRINGrecipient's e-mail address
SUBJECT STRINGe-mail subject
MESSAGE STRINGe-mail body text
SEND BOOL command to send the e-mail
OutputTypeDescription
RESULTSINTNumeric status; result of the system settings check

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.

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


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.

  • © Energocentrum Plus, s.r.o. 2017 - 2024