FP_SMTP_SET_EMAIL_TEXT

Set e-mail text

This FP instruction sets the text specified by sBodyText as the predefined e-mail text.

Parameters

Input

nTransferID (WORD, INT, UINT)

Set the transfer setting ID.

Values: 0–15

sBodyText (STRING)

Stores the text to be used as the predefined e-mail text

Output

bError (BOOL)

Set to TRUE when the operation ends abnormally.

When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.

Remarks

  • 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.

  • Before you execute the instruction, make sure that sys_bIsEthernetInitializing is FALSE. sys_bIsEthernetInitializing turns to TRUE when the instruction is executed. When you execute the instruction while sys_bIsEthernetInitializing is TRUE, an 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.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • 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.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • 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.

sys_bIsCarry (turns to TRUE for one scan)
  • if the instruction is executed during the initialization of Ethernet, sys_iEthernetConnectionErrorCode is set to "11: Ethernet is being initialized".

Example

POU header

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

POU body

If bRequest changes from FALSE to TRUE and sys_bIsEthernetSMTPClientReady is set to TRUE, the instruction is executed.

LD body

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

ST body

If DF(bRequest) AND sys_bIsEthernetSMTPClientReady then
    FP_SMTP_SET_EMAIL_TEXT(nTransferID := iID8,
                           sBodyText := sEmailText,
                           bError => bError);
End_if;

Modified on: 2024-03-06Feedback on this pagePanasonic hotline