Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter TwelveInternet Functions (continued)

POPConnect Function

Overview

The POPConnect function establishes a session connection to a mail server using specified credentials and returns a handle to a POP Object.

Syntax/Parameters

Syntax

handle = POPConnect ( string server, string user, string password, [int port] );

Parameters

server

A string containing the address of the server. In many cases, the server addresses will require a subdomain such as “mail” or “pop3” added to the domain authority. For example, “pop3.myserver.com”.

user

A string containing the user name to log into the mail server.

password

A string specifying the corresponding password for the user name.

port

An optional int specifying a port number to use. The default port is 100.

Return Value

Returns a handle for a POP Object or NULL_HANDLE (0) on failure. On failure, use the GetLastError and GetLastErrorMessage functions to retrieve additional details. When the handle is no longer needed, the CloseHandle function must be used to release the connection.

Remarks

After connecting to the mail server, the script can access the default inbox for the specified user. The handle essentially gives a snapshot of the inbox which can then be examined or managed by the script. The handle should be treated as transient, meaning the script should perform its work and then release the connection using CloseHandle. If the connection is left idle for an extended period of time, the connection will time out and subsequent calls to the server using the specified handle will fail.

Deleted messages are processed by the server after the session is disconnected.

When connecting, error codes can be returned at a number of levels. The first is simply resolving the domain name. After the server has been contacted, several POP3 error codes can be returned by the server. These will be in the low word of the formatted error code.

After connecting, the POP protocol only accesses a single user folder for the mail box, usually the folder designated as ‘Inbox’. While IMAP and POP3 can be supported at the same time, POP3 does not support accessing multiple folders.

The default port number is 110, check with the specific mail server for the appropriate port number. Secure port numbers may vary.

During connection, user credentials are encrypted, however, the method is not considered a strong encryption since it is subject to hacking if an intruder can get access to a large sampling of log-in packets.

If the script is the sole mail box manager, it should delete messages using the POPDeleteMessage function to avoid mailbox overload. Further, with each call to list IDs or messages, the process will become progressively slower as the mailbox grows in size.

User credentials can be stored using the GetSetting and PutSetting functions or the encrypted versions, GetEncryptedSetting and PutEncryptedSetting. It is generally a good idea to not hard code passwords.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic