SMTP – Block for sending e-mail alerts via SMTP
Block SymbolLicensing group: ADVANCED
Function Description
The SMTP block sends a single e-mail message via standard SMTP protocol. The block acts as
a simple e-mail client. It does not implement a mail server.
The content of the message is defined by the subj and body inputs. The from and to parameters specify the sender and recipient of the message. The message is sent when a rising edge (offon) is detected at the TRG input. The BUSY output is set to on until the request is completed, which is signaled by the DONE output. In case of an error, the ERROR output is set to on. The errId output carries the last error identified by the REXYGEN system error code. The domain parameter must always be set to identify the target device. The default value should work in most cases. There may be multiple message recipients. In such a case, individual e-mail addresses must be separated by a comma and no space character should be present.
The block may be run in non-blocking or blocking mode, which is specified by the BLOCKING parameter:
- In the blocking mode, the execution of a task is suspended until the sending of e-mail is completed. This mode is typically used in tasks with long execution period, . If the e-mail is not successfully sent until timeout expires, an error is indicated and the execution of the task is resumed.
- In the non-blocking mode, the SMTP block performs only a single operation in each execution of the block and the execution of a task is not suspended. This mode is typically used in tasks with short execution period, . In this mode, the timeout parameter should be set to at least , where is the execution period in seconds.
It is recommended to run the SMTP block in the non-blocking mode. It is however necessary to mention that on various operating systems some operations may not be performed in the non-blocking mode, so be careful and do not use this block in quick tasks (see QTASK) or in tasks with extremely short execution period (few milliseconds). The non-blocking mode is best supported on GNU/Linux operating system.
The block supports user authentication using standard SMTP authentication method. User name and password may be specified by the user and password parameters. The block also supports secure connection. The encryption method is selected by the tls parameter. It is also possible to let the block verify server’s certificate by setting the VERIFY parameter. SSL certificate of a server or server’s trusted certificate authority must be stored in the certificate parameter in a PEM format. The block does not support any certificate storage.
The length of the whole message (subject, body and headers) is limited to a maximum of 1024 characters.
This block does not propagate the signal quality. More information can be found in the 1.4 section.
Input
subj | Subject of the e-mail message | String |
body | Body of the e-mail message | String |
TRG | Trigger of the selected action | Bool |
Parameter
server | SMTP server address | String |
to | E-mail of the recipient | String |
from | E-mail of the sender | String |
tls | Encryption method 1 | Long (I32) |
|
|
|
user | User name | String |
password | Password | String |
domain | domain | String |
auth | Authentication method 1 | Long (I32) |
|
|
|
certificate | Authentication certificate | String |
VERIFY | Enable server verification (valid certificate) | Bool |
timeout | Timeout interval | Double (F64) |
BLOCKING | Wait for the operation to finish | Bool |
Output
BUSY | Sending e-mail | Bool |
DONE | E-mail has been sent | Bool |
ERROR | Error indicator | Bool |
errId | Error code | Error |
[Previous] [Back to top] [Up] [Next]
2024 © REX Controls s.r.o., www.rexygen.com