Skip to main content
Version: 4.2.5

POP3 Object

Overview

Retrieves mail from any POP3 server. The object retrieves and stores sets of messages in the Message property. Downloaded messages are available through the Mail Message Object.

Sections

Init, Main, Procedures, OnExit, and Structure.

note

The object is declared in the Declare section.

Properties

NameDescription
StateThe state of the POP3 Object
TimeoutTimeout in milliseconds.
ServerMsgCountNumber of unread messages at the server.
LocalMsgCountNumber of downloaded messages.
MessageReturns a message that is already downloaded.
ObjectIsEmptyReturns 1 if object is not created.
LastReturnCodeReturns last known return code from object.
note

Properties ObjectIsEmpty and LastReturnCode are common methods. For more information see Common properties and methods.

Methods

NameDescription
LoginEstablishes a session.
LogoutEnds a session.
DownloadMessagesDownloads messages from server.
DeleteMessagesMarks messages to delete on server.
CreateObjectCreates a new instance of the object.
FreeObjectReleases the instance of the object.
note

Methods CreateObject and FreeObject are common methods. For more information see Common properties and methods.

See Also

SMTP Object
Mail Message Object

Properties


State

State of the POP3 Object.

Type: MailStateConstants
Default: -
Read: get_State
Write: -

See Also

MailStateConstants
POP3 Object::Login
POP3 Object::Logout


Timeout

Timeout in milliseconds.

Default value: 30000

Type: Integer
Default: -
Read: get_Timeout
Write: put_Timeout


ServerMsgCount

Number of unread messages at the server. Automatically filled after a successful login.

Type: Integer
Default: -
Read: get_ServerMsgCount
Write: -

See Also

POP3 Object::LocalMsgCount


LocalMsgCount

Number of downloaded messages. Use this property for a maximum value of the LocalIndex parameter in the Message property.

Type: Integer
Default: -
Read: get_LocalMsgCount
Write: -

See Also

POP3 Object::ServerMsgCount


Message

Returns a message that is already downloaded. Index is 1 to POP3 Object::LocalMsgCount. Use this property to get hold of the downloaded messages. Type: Integer
Default: -
Read: get_Message
Write: -

See Also

Mail Message Object
POP3 Object::LocalMsgCount
POP3 Object::DownloadMessages


Methods


Login

Establishes a session. Server parameter may be either a host name or a dot address. Returns True_Value (1) on success.

Implicit SSL will be used unless StartTLSOption specifies Always or Retry (implicit SSL will be used in first handshake attempt though).

Most POP servers require a username and password, so you should specify both. After a successful login the ServerMsgCount property is set to the number of messages on the server.

Parameters

ServerType: String

Description: Can be either:
  • a host name (example: server.com)
  • an IP address (example: 192.168.0.0)
  • An auto configuration (example: auto:MicrosoftOffice365)

For more information, see Well-known mail servers.

PortType: Integer

Default: 110

Description: Specifies the port number. Defaults to the "well-known" port 110.
UsernameType: String

Default: '

Description: Specifies the server account to access.
PasswordType: ParamTypePassword

Default: '

Description: Specifies the password for the server account.
StartTlsOptionType: MailStartTlsOptions

Default: Retry

Description: Specifies how Start TLS will be used.
Possible values are:
  • Never
  • Always
  • Retry
SSLVersionsType: SSLVersions

Default: TLS 1.3, TLS 1.2

Description: Specifies which SSL/TLS version(s) that may be used.
For more information, see General information about SSL and TLS.
ReturnValueType: ParamTypeBool

Description: Returns True_Value (1) on success.

See Also

POP3 Object::Logout
POP3 Object::State
POP3 Object::ServerMsgCount


Logout

Ends a session.

Successful execution of this method permanently removes any "marked-for-delete" messages from the server, ends the session, and causes the server to terminate the connection. Failure to use this method causes the server to clear any pending "marked-for-delete" message flags.

note

The property MsgNumber is set to 0 for all downloaded messages when logged out.

Parameters

---

See Also

POP3 Object::Login
POP3 Object::State
POP3 Object::DeleteMessages


DownloadMessages

Downloads messages from server.

The method makes it easy to download any or all parts of a set of messages. The destination for messages is the Messages property.

Messages are not automatically deleted by default when they are downloaded. You must delete messages explicitly by using the DeleteMessages method.

Parameters

PartType: MailGetPartConstants

Default: MailGetAll

Description: Specifies the message part or attribute to be retrieved.
MsgSetType: String

Description: If MsgSet="" all messages are fetched. To specify messages to fetch, use message indexes (from 1 to ServerMsgCount). Example: "1, 5:7, 12"

See Also

MailGetPartConstants
POP3 Object::DeleteMessages
POP3 Object::LocalMsgCount


DeleteMessages

Marks messages to delete on server.

Messages specified in the parameter MsgSet are "marked" for deletion. The message are removed when the session is gracefully ended using Logout. If Logout is not used, for example if the system goes down unintentionally, the messages marked for deletion are "de-marked" and will not be deleted.

Parameters

MsgSetType: String

Description: If MsgSet="" all messages are deleted. To specify messages to delete, use message indexes (from 1 to ServerMsgCount). Example: "1, 5:7, 12"

See Also

MailGetPartConstants