smtpClose (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.50 / 1.00.00


This function will close the SMTP interface. After the SMTP interface is closed, it cannot be used until opened again.

Please also see smtpOpen.

 

When closing the SMTP interface, all emails created with smtpNew and smtpSend will be canceled, and all waiting threads (using smtpAwaitCompletion) will be resumed.

 

 

Input:

None.

 

Returns: INT

0

- Success.

-1

- General error.

 

Declaration:

FUNCTION smtpClose : INT;

 

Example:

INCLUDE rtcu.inc
 
VAR
  ignition : BOOL;
END_VAR;
 
PROGRAM example;
VAR
  smtp_open : BOOL;
END_VAR;
 
  gsmPower(power := ON);
  netOpen(iface:=1);
BEGIN
  IF ignition THEN
    IF NOT smtp_open THEN
        IF smtpOpen() = 0 THEN
           smtp_open := TRUE;
        ELSE
          DebugMsg(message:="smtpOpen - Failed!");
        END_IF;
    END_IF;
  ELSE
    IF smtp_open THEN
        smtpClose();
        smtp_open := FALSE;
    END_IF;
  END_IF;
END;
 
END_PROGRAM;