SMTP transfer request
This FP instruction requests the SMTP client to send an e-mail and transfer data as specified by nTransferID.
Input
Set the SMTP client ID
Values: 0–15
Output
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.
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, check if the system variable sys_bIsEthernetSMTPClientReady is TRUE. If it is FALSE when executing the instruction, an 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.
The instruction can only be executed when sys_bIsEthernetCableNotConnected is FALSE.
The instruction can only be executed when the transfer request flag for the specified transfer setting is "FALSE: No transfer request". When the transfer request flag is "TRUE: Transfer requested", 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 system variable sys_bIsEthernetSMTPClientReady is FALSE when the instruction is executed.
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 sending of e-mails is disabled, i.e. if the identifier bIsTransmissionBlocked of FP_CLIENT_STATUS_DUT is 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 system variable sys_bIsEthernetSMTPClientReady is FALSE when the instruction is executed.
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 sending of e-mails is disabled, i.e. if the identifier bIsTransmissionBlocked of FP_CLIENT_STATUS_DUT is TRUE.
if the instruction is executed while the Ethernet cable is disconnected. sys_iEthernetConnectionErrorCode is set to "10: Ethernet cable disconnected".
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
iID10: INT:=10;
bTransferRequestError: BOOL:=FALSE;
bTransferRequest: BOOL:=FALSE;
END_VAR
If bTransferRequest changes from FALSE to TRUE and the system variable sys_bIsEthernetSMTPClientReady is TRUE, the instruction is carried out. The SMTP transfer is requested for the Ethernet unit 10.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 4 ;
NETWORK_BODY
B(B_CONTACT,,bTransferRequest,4,1,6,3,R);
B(B_VARIN,,iID10,23,2,25,4,);
B(B_VAROUT,,bTransferRequestError,40,2,42,4,);
B(B_F,FP_SMTP_TRANSFER_REQUEST!,,25,0,40,4,,?DEN?DnID?AENO?CbError);
B(B_CONTACT,,sys_bIsEthernetSMTPClientReady,15,1,17,3,);
L(1,2,4,2);
L(6,2,15,2);
L(17,2,25,2);
L(1,0,1,4);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if DF(bTransferRequest) AND sys_bIsEthernetSMTPClientReady then
FP_SMTP_TRANSFER_REQUEST(nTransferID := iID10,
bError => bTransferRequestError);
End_if;