tcp.getMail

Syntax tcp.getMail (host, username, password, adrMsgTable, deleteMessages, timeOutTicks, flMessages, adrDeleteCallback)

Params host is a string, the host name or IP address of a POP mail server.

username is a string, the name of the POP account being accessed.

password is a string, the password for the above account.

adrMsgTable is the address of a table that is created and filled with message items. The table is created if it doesn't exist. If adrMsgTable exists, it is emptied before any mail is retrieved.

deleteMessages is a boolean, if true then mail will be deleted as it is downloaded. The default is the value at user.prefs.getMail.deleteMessages.

timeOutTicks is a number, specifying after how many ticks the script will time out when waiting for a response from the server. If a timeout occurs, the connection is closed and an error message is generated. The default value is the value at user.prefs.getMail.timeOutTicks.

flMessages is a boolean, if true then the POP host responses and other status messages are displayed in the About window. The default value is the value at user.prefs.getMail.flMessages.

adrDeleteCallback is a boolean, if false, then this callback is called with the address of each message table. If the callback returns true, then the message is deleted from the server -- if false, then the message is not deleted.

Action Retrieves all mail items in a POP mail account.

Returns true

Errors If there's an error retrieving an email message, tcp.getMail throws a script error which you can trap with a try statement.

Examples tcp.getMail ("myPophost.com", "myAcctName", "secretPW", @temp.mailstorage)

   » true

Notes This verb requires regex, included with Frontier. If you have not installed regex, please see your Frontier installation instructions.

This verb requires a user preferences table at user.prefs.getMail containing the items:

  • user.prefs.getMail.deleteMessages, a boolean, if true getMail will delete mail from the pop server by default.

  • user.prefs.getMail.flMessages, a boolean, if true getMail will display status messages in the About window by default.

  • user.prefs.getMail.timeOutTicks, a number, the number of ticks getMail will wait for a response from the mail host before exiting with a timeout script error.

This verb stores each mail item as a sub-table in the table whose address is passed in the adrMsgTable parameter.

Items are created in these sub-tables for each message header (i.e. Subject, To, etc.) and the message text. If the message is a multi-part mime format message, the parts are extracted from the message and stored in a sub-table called "parts".

Discuss