Overview Mail send

With this function block, an email can be sent, for example for monitoring or to send a CSV file. An external mail server is used for this; in order for mails to be sent, the controller must be able to access the internet. Via Edit - Mail settings, a custom mail server can also be used.

Important: The internal mail server only allows a certain number of mails within a certain time span. If too many mails are sent, the sender is blocked for a certain time. This serves as protection against spam mails and is specified by the mail provider. Therefore, a maximum of 30 mails per day should be sent.


Inputs

TR
Trigger
Trigger on which the mail is sent; see parameter Trigger.
E1-x
Input 1-x
Depending on the parameter Number of inputs, arbitrary status values can also be sent with the mail, for example states of fault inputs.
RS Reset With a rising edge, the error counter and block time are set to 0. Affects all mail blocks, so the reset input only needs to be connected at one block.
FG Enable Optional enable. If this input is connected, mails are only sent when the input is not equal to 0, otherwise always. This input can be used, for example, to enable / disable certain recipients via the visualization.

Outputs

AZ
Count
Number of mails sent.
ER
Error
Number of errors
FZ
Filter time
Time in seconds within which further triggers are ignored.

Parameters

Trigger

  • Rising edge: Mail is sent on a change of the Trigger input from 0 to 1.
  • Falling edge: Mail is sent on a change of the Trigger input from 1 to 0.
  • On change: Mail is sent on every change of the input. 
  • On every telegram: Mail is sent on reception of a telegram with the WRITE command.

Filter time
Filter time in seconds. So that, in the event of frequent triggering, not too many mails are sent, a filter in seconds can be specified here. After sending the first mail, this time is waited before a trigger is allowed again. This time is also observed at the start of the runtime, so that it can be prevented that, when loading the project, mails are unintentionally sent.
Recipient
Email address of recipient. Several recipients can be specified separated by semicolon (without spaces).
Subject
Subject
Text
Email text
Attachment
Attachment, for example a CSV file. Separated by a semicolon several files can be attached. The files are searched for in the working directory of the project, a path cannot be specified. The characters / \ : * ? " < > | are not allowed in a file name.
Number of inputs
Number of inputs.
Rename attachment Optional. With this option the attachment can be renamed, for example to append a date. Example: log_%d_%m_%Y.csv is renamed to log_10_11_2023.csv. If nothing is specified in this parameter, the original file name is used.
If several files are specified in the parameter Attachment, a separate pattern for each file can be specified here, separated by a semicolon. Example: Attachment log.csv;error.csv, Rename attachment log_%Y%m%d.csv;error_%Y%m%d.csv. For files without their own pattern the original name is used. For renaming, a copy of the file is created which is deleted again after sending. The original file is kept.
The available placeholders are described at FTP Upload.
Rename attachment offset Time offset in seconds for renaming the attachment. For example -3600 means minus 1 hour. If the mail is for example sent at 0:00h and you want to use the date of the previous day, an offset can be specified with this parameter.


See also common parameters of all function blocks.