wiki:Documentation/ARexxAPI/MAILCHECK

Version 8 (modified by damato, 9 months ago) (diff)

--

Languages:

MAILCHECK

NAME
MailCheck -- Download new mail.
TEMPLATE
VAR/K,STEM/K,POP/K/N,MANUAL/S
FUNCTION
Downloads new email from the specified POP3 account, or from all of them if none is specified.
INPUTS
VAR/K - alternative variable to put the results into instead of RESULT (V2.0)
STEM/K - base name used for the stems where the returned data will be stored (V2.0)
POP/K/N - POP3 mail account to check, specified as the position in the list of POP3 accounts in Configuration ->TCP/IP; the account at the top is account 0 (V2.0)
MANUAL/S - open the transfer window to enable user interaction, i.e. message preselection (V2.0)
RETURNS
VAR - info returned by the query
<STEM>DOWNLOADED - total number of downloaded emails
<STEM>ONSERVER - total number of emails remaining on the server
<STEM>DUPSKIPPED - total number of duplicates skipped
<STEM>DELETED - total number of emails deleted from the server

In V1.x, RC was always set to 0. As of V2.0 however, RC is set to 5 if the TCP/IP stack is not online.

Likewise, in V1.x RESULT was set to the number of downloaded emails, or -1 if the connection to the mail server failed.

NOTES
The command returns immediately if MANUAL is used.

If no account is specified, the command will only check those mail accounts marked as "active" in the configuration, just like if the "Get" button was pressed in the toolbar.

EXAMPLE
/* Enable result codes */
OPTIONS RESULTS

/* Download email from a mail account */
MAILCHECK POP 2 STEM st.

/* Display results */
IF RC = 0 THEN DO
  SAY 'Downloaded emails:  'st.downloaded
  SAY 'Left on server:     'st.onserver
  SAY 'Duplicates skipped: 'st.dupskipped
  SAY 'Deleted on server:  'st.deleted
END
ELSE
  SAY 'Error during mail download.'
EXIT
BUGS
RC was set to 5 if no mail was found on the server, and <STEM>ONSERVER simply returned the number of messages found. Both were fixed in V2.4.
SEE ALSO