smtpCancel (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.50 / 1.00.00


This function will stop a mail transfer and remove the email from the outbox. An email must be created by smtpNew before it can be canceled.

An email can be canceled at any time in its lifetime - from its creation to the completion of the email transfer.

 

When the email is canceled, all waiting threads (using smtpAwaitCompletion) will be resumed.

 

 

Input:

Handle : INT

The handle for the email.

 

Returns: INT

0

- Success.

-1

- General error.

-2

- SMTP interface is not open.

-5

- Invalid mail handle.

 

Declaration:

FUNCTION smtpCancel : INT;
VAR_INPUT
  Handle : INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
  md   : INT;
  rc   : INT;
END_VAR;
 
PROGRAM example;
 
  gsmPower(power := ON);
  netOpen(iface := 1);
  smtpOpen();
 
  DebugMsg(message := "Application running");
 
BEGIN
  ...
  md := smtpNew(Receiver := "your@email.address", Subject := "example");
  ...
  rc := smtpSendX(Handle := md);
  IF rc = 0 THEN
     ...
    smtpCancel(Handle := md);
     ...
  END_IF;
  ...
END;
END_PROGRAM;