mailreader

Top  Previous  Next

o=new("mailreader",server$,port,timeout,ssl,login$,password$)

 

The mailreader object provides functionality to read emails from a POP mail server.  Email content is provides via "messages" object collection, with each object of that collection being a message object.  All parameters are optional, but are positional.  Each value can also be set by assigning a property value, and defaults are defined in the email.ini file in the [mailreader] section.

 

When reading messages from a POP mail server, each message is given a unique ID by the server.  This ID is provided in message lists as the popid$ property of any given message object when messages are listed.  The ID is used for message retrieval or deletion.

 

An example of using the mailreader object is found in the samples/emailarchive.rul file.

 

 

Properties

apop

Set to true (1) to use APOP security, or false to not.  The default is true.

errmsg$

The last error message.

logdetail

Set to 1 to enable detailed logging to logfile$

logfile$

Sets the log file name.

login$

The POP user login.

messages

A collection object that holds the most recent collection of messages read.  Read-only.

password$

The POP user password.

port

The port to connect to, which defaults to 110 for standard POP, or 995 for SSL.

server$

The POP mail server name or IP address

ssl

Set to 1 for POPS (POP or SSL protocol)

timeout

Timeout in seconds for server communication.  Defaults to 30 seconds.

 

 

Methods

getstatus(count,size)

Requests status from the mail server, and fills in the count and size values with the number of pending messages and the total size in bytes of those messages.

getlist([toplines])

Fills the messages property with basic message content, including header information and up to toplines message lines.  No attachments are downloaded.  Returns the number of messages downloaded.  Message objects each include the popid$ property, which can be used to retrieve full message content.

getmsgs([msglist|msgstr$])

Fills the messages property with messages requested.  If no list is provided, then all messages are downloaded.  The message list can be either an object collection whose keys are message IDs (the popid$ property from a message object), or a string of space-separated IDs.  The message objects added to the messages collection are fully populated with data, including attachments.

delmsgs(msglist|msgstr$)

Removes the messages from the server.  The message list can be either an object collection whose keys are message IDs, or a string of space-separated IDs.