FP_SMTP_TRANSFER_CONTROL_LOG

Control of SMTP transfer of data recording files

This FP instruction controls the SMTP transfer of a data recording file specified by nLogID. Valid control words are 'ENABLE', 'DISABLE' and 'CANCEL'.

Parameters

Input

nLogID (WORD, INT, UINT)

LOG number (permissible range: 0–15). The compiler generates internally the string for the log file number, e.g. 'LOG=0'

sControl (STRING)

Control string:

  • 'ENABLE': enables file transfer

  • 'DISABLE': disables file transfer

  • 'CANCEL': cancels file transfer

Output

bError (BOOL)

Turns to TRUE under the following conditions:

  • if a timeout of the connection is exceeded

  • if an IP address is invalid

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

Remarks

  • The number of characters for string data must not exceed 256.

  • Before you execute the instruction, you need to specify the e-mail transfer settings for data recording files using FP_SMTP_SET_MODE_TRANSFER_LOG or the setting dialog of the SMTP client.

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

  • Upper and lower case characters can be used for operands for which a character constant can be specified. "Abcd", "ABCD" and "abcd" are synonymous, however, file names are case-sensitive.

  • When this instruction has been executed successfully, the system variables sys_bIsCarry and sys_iEthernetConnectionErrorCode are reset.

  • It takes some time to process the transfer cancel request. Check the transfer status with FP_SMTP_GET_STATUS and check if the transfer stops after executing the instruction.

  • 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 any control string other than 'ENABLE', 'DISABLE' or 'CANCEL' is specified for sControl.

  • if the number of characters for string data exceeds 256.

  • if an e-mail transmission setting for data recording files that has not been configured with the instruction FP_SMTP_SET_MODE_TRANSFER_LOG or the setting dialog of the SMTP client is specified.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if any control string other than 'ENABLE', 'DISABLE' or 'CANCEL' is specified for sControl.

  • if the number of characters for string data exceeds 256.

  • 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 an e-mail transmission setting for data recording files that has not been configured with the instruction FP_SMTP_SET_MODE_TRANSFER_LOG 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
		bIsError: BOOL:=FALSE;
		bSetLogTransferSMTP: BOOL:=FALSE;
		bDisableLogTransferSMTP: BOOL:=FALSE;
	END_VAR

POU body

If bSetLogTransferSMTP and bDisableLogTransferSMTP are set to TRUE, the instruction is carried out.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 7 ;
        NETWORK_BODY
B(B_VARIN,,0,19,2,21,4,);
B(B_VARIN,,'GRPNO=0~SUBJECTAUTO',19,3,21,5,);
B(B_VARIN,,'Sent Log Files',19,4,21,6,);
B(B_VARIN,,'INFO=NON~ATT=NONE',19,5,21,7,);
B(B_VAROUT,,bIsError,39,2,41,4,);
B(B_CONTACT,,bSetLogTransferSMTP,5,1,7,3,);
B(B_F,FP_SMTP_SET_MODE_TRANSFER_LOG!,,21,0,39,7,,?DEN?DnLogID?DsGroupNumber_Subject?DsBodyText?DsAttachment?AENO?AbError);
L(1,2,5,2);
L(7,2,21,2);
L(1,0,1,7);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_CONTACT,,bDisableLogTransferSMTP,5,1,7,3,);
B(B_F,FP_SMTP_TRANSFER_CONTROL_LOG!,,21,0,39,5,,?DEN?DnLogID?DsControl?AENO?AbError);
B(B_VARIN,,0,19,2,21,4,);
B(B_VARIN,,'DISABLE',19,3,21,5,);
B(B_VAROUT,,bIsError,39,2,41,4,);
L(1,2,5,2);
L(7,2,21,2);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

If (bSetLogTransferSMTP) Then
    FP_SMTP_SET_MODE_TRANSFER_LOG(nLogID := 0,
                                  sGroupNumber_Subject := 'GRPNO=0,SUBJECTAUTO',
                                  sBodyText := 'Sent Log Files', 
								  sAttachment := 'INFO=NON,ATT=NONE', bError => bIsError);
End_if;
If (bDisableLogTransferSMTP) Then
    FP_SMTP_TRANSFER_CONTROL_LOG(nLogID := 0,
                                 sControl := 'DISABLE', bError => bIsError);
End_if;

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