Control of SMTP transfer to a single Ethernet unit
This FP instruction controls the SMTP transfer to a single Ethernet unit specified by nTransferID. Valid control words are 'ENABLE'
, 'DISABLE'
and 'CANCEL'
.
Input
Ethernet unit ID (values: 0–15)
Control string:
'ENABLE'
: enables e-mail transfer to the Ethernet unit
'DISABLE'
: disables e-mail transfer to the Ethernet unit
'CANCEL'
: cancels e-mail transfer to the Ethernet unit
Output
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.
The number of characters for string data must not exceed 256.
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.
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, 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.
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.
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 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 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
bEnable: BOOL:=FALSE;
bError: BOOL:=FALSE;
iID8: INT:=8;
END_VAR
If bEnable changes from FALSE to TRUE, the instruction is carried out. The SMTP transfer is enabled for Ethernet unit 8.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 8 ;
NETWORK_BODY
B(B_CONTACT,,bEnable,4,1,6,3,R);
B(B_VARIN,,iID8,8,2,10,4,);
B(B_VARIN,,'ENABLE',8,3,10,5,);
B(B_VAROUT,,bError,26,2,28,4,);
B(B_F,FP_SMTP_TRANSFER_CONTROL!,,10,0,26,5,,?DEN?DnTransferID?DsControl?AENO?CbError);
L(1,2,4,2);
L(6,2,10,2);
L(1,0,1,8);
END_NETWORK_BODY
END_NET_WORK
END_BODY
If DF(bEnable) Then
FP_SMTP_TRANSFER_CONTROL(nTransferID := iID8,
sControl := 'ENABLE',
bError => bError);
End_If;