Teleservice communication (SMTP email)
13.1
TM_Mail (Send email) instruction
Table 13- 1
TM_MAIL instruction
LAD / FBD
STEP 7 automatically creates the instance DB when you insert the instruction.
1
You start sending an email with a positive edge change from 0 to 1, at input parameter REQ.
The following table shows the relationship between BUSY, DONE and ERROR. You can
monitor the progress of TM_MAIL execution and detect completion, by evaluating these
parameters in successive calls.
The output parameters DONE, ERROR, STATUS, and SFC_STATUS are valid for only one
cycle, when the state of the output parameter BUSY changes from 1 to 0. Your program
logic must save temporary output state values, so you can detect state changes in
subsequent program execution cycles.
Table 13- 2
Interaction of the Done, Busy and Error parameters
DONE
BUSY
Irrelevant
1
1
0
0
0
0
0
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
SCL
"TM_MAIL_DB"(
REQ:=_bool_in_,
ID:=_int_in_,
TO_S:=_string_in_,
CC:=_string_in_,
SUBJECT:=_string_in_,
TEXT:= _string_in_,
ATTACHMENT:=_variant_in_,
BUSY=>_bool_out_,
DONE=>_bool_out_,
ERROR=>_bool_out_,
STATUS=>_word_out_,);
ERROR
Description
Irrelevant
Job is in progress.
0
The job was completed successfully.
1
The job was terminated with an error. For the cause of the error, refer to the
STATUS parameter.
0
No job in progress
Description
The TM_MAIL instruction sends an email
message using the SMTP (Simple Mail
Transfer Protocol) over TCP/IP via the
CPU Industrial Ethernet connection. Where
Ethernet-based Internet connectivity is not
available, an optional Teleservice adapter
can be used for connection with telephone
land lines. TM_MAIL executes
asynchronously and the job extends over
multiple TM_MAIL calls. When you call
TM_MAIL, you must assign an instance
DB. The instance DB retentive attribute
must not be set. This ensures that the
instance DB is initialized in the transition of
the CPU from STOP to RUN and that a
new TM_MAIL operation can be triggered.
13
775