Set e-mail text
This FP instruction sets the text specified by sBodyText as the predefined e-mail text.
Input
Set the transfer setting ID.
Values: 0–15
Stores the text to be used as the predefined e-mail text
Output
Set to TRUE when the operation ends abnormally.
When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.
This instruction is not available in interrupt programs.
Before you execute the instruction, you need to specify the e-mail transmission settings using FP_SMTP_SET_MODE or the setting dialog of the SMTP client.
Before you execute the instruction, you need to specify the group and event e-mail settings using FP_SMTP_SET_GROUP or the setting dialog of the SMTP client.
Before you execute the instruction, check FP_CLIENT_STATUS_DUT whether there is an active request to send an e-mail. If bIsTransferRequested is TRUE when you execute the instruction, an operation error occurs.
When this instruction has been executed successfully, the system variables sys_bIsCarry and sys_iEthernetConnectionErrorCode are reset.
When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.
if the area specified using the index modifier exceeds the limit.
if a value specified for a parameter is outside the permissible range.
if the instruction is executed in an interrupt program.
if the e-mail transmission request flag for the specified transfer setting is "TRUE: Transfer requested".
if an e-mail transmission setting that has not been configured with the instruction FP_SMTP_SET_MODE or the setting dialog of the SMTP client is specified.
if a destination group number that has not been defined with the instruction FP_SMTP_SET_GROUP or the setting dialog of the SMTP client is specified.
if the area specified using the index modifier exceeds the limit.
if a value specified for a parameter is outside the permissible range.
if the instruction is executed in an interrupt program.
if the e-mail transmission request flag for the specified transfer setting is "TRUE: Transfer requested".
if an e-mail transmission setting that has not been configured with the instruction FP_SMTP_SET_MODE or the setting dialog of the SMTP client is specified.
if a destination group number that has not been defined with the instruction FP_SMTP_SET_GROUP or the setting dialog of the SMTP client is specified.
if the instruction is executed during the initialization of Ethernet, sys_iEthernetConnectionErrorCode is set to "11: Ethernet is being initialized".
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
bRequest: BOOL:=FALSE;
bError: BOOL:=FALSE;
iID8: INT:=8;
sEmailText: STRING[32]:='Hello World!';
END_VAR
If bRequest changes from FALSE to TRUE and sys_bIsEthernetSMTPClientReady is set to TRUE, the instruction is executed.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_CONTACT,,bRequest,4,1,6,3,R);
B(B_VARIN,,iID8,23,2,25,4,);
B(B_CONTACT,,sys_bIsEthernetSMTPClientReady,15,1,17,3,);
B(B_VARIN,,sEmailText,23,3,25,5,);
B(B_F,FP_SMTP_SET_EMAIL_TEXT!,,25,0,39,5,,?DEN?DnTransferID?DsBodyText?AENO?CbError);
B(B_VAROUT,,bError,39,2,41,4,);
L(1,2,4,2);
L(6,2,15,2);
L(17,2,25,2);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
If DF(bRequest) AND sys_bIsEthernetSMTPClientReady then
FP_SMTP_SET_EMAIL_TEXT(nTransferID := iID8,
sBodyText := sEmailText,
bError => bError);
End_if;