S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
1301
TeleService communication (SMTP email)
TM_Mail (Send email) instruction
Table 14- 1 TM_MAIL instruction
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_,);
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 asynchro-
nously and the job extends over multiple
TM_MAIL calls. When you call TM_MAIL,
you must assign an instance DB.
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.
1
STEP 7 automatically creates the instance DB when you insert the instruction.
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.
Note
TM_MAIL sends a mail message over TCP/IP using the Ethernet interface of the CPU. To
send a mail message over a CP interface (with or without SS
L) use the instruction TMAIL_C
(Send an email using the Ethernet interface of the CPU) instruction
(Page 885).