smtpStatus (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.50 / 1.00.00


This function will return the status and progress of an email. An email must be created by smtpNew before the status can be requested.

 

Note: if there are attachments to the email, then the email message will count as 50% of the progress and the attachments as the last 50%.

 

 

Input:

Handle : INT

The handle for the email.

 

Returns: INT

Percentage of the mail transfer completed.

-1

- General error.

-2

- SMTP interface is not open.

-5

- Invalid email handle.

-8

- Email server not found.

-10

- Email transfer error.

-14

- The server certificate failed to validate.

-15

- The secure connection failed.

 

Declaration:

FUNCTION smtpStatus : 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
     ...
     rc := smtpStatus(Handle := md);
    IF rc >= 0 THEN
        DebugFmt(message := "Completed: \1%", v1 := rc);
    END_IF;
     ...
  END_IF;
  ...
END;
END_PROGRAM;