TPop3Cli.Top

From Overbyte
Jump to: navigation, search

Main page -> ICS component reference -> TPop3Cli -> Top

Definition

<syntaxhighlight lang="delphi"> procedure Top; virtual; </syntaxhighlight>

Description

Sends TOP command to a POP3 server. This command is valid only during TRANSACTION state. It retrieves a header along with a number of lines of a message. Headers and message lines are retrieved using OnMessageBegin, OnMessageLine and OnMessageEnd events.

To specify which message headers and how many lines of body text you want to retrieve MsgNum and MsgLines to a specific value prior to calling Top(). So if you want only headers and no body text, set MsgNum to number of message and MsgLines to zero. This method is useful for retrieving only message information without downloading entire message.

This command is in optional set and not supported by all POP3 servers so make sure you handle a possible error response.

Delphi Example

<syntaxhighlight lang="delphi"> // Retrieves message 1 only headers with no body text Pop3Cli.MsgNum := 1; Pop3Cli.MsgLines := 0; Pop3Cli.Top; </syntaxhighlight>

See List or Uidl for more comprehensive example. Also you can look for OverbyteIcsMailRcv1 demo included in ICS distribution package.

C++ Example

<syntaxhighlight lang="cpp"> // Retrieves message 1 only headers with no body text Pop3Cli->MsgNum = 1; Pop3Cli->MsgLines = 0; Pop3Cli->Top(); </syntaxhighlight>

See List or Uidl for more comprehensive example. Also you can look for OverbyteIcsMailRcv1 demo included in ICS distribution package.