Xbase++
Xbase++
Explicitly Begin a POP3 Session
See more POP3 Examples
Demonstrates the Chilkat MailMan.Pop3BeginSession method, which explicitly begins a POP3 session by connecting to the POP3 server and authenticating using the current POP3 property settings. Calling it is optional. This example begins a session, performs a mailbox operation, and ends the session.
Background:
Pop3BeginSession combines connecting and authenticating into one call. Chilkat does this automatically when a mailbox operation needs it, so the value of calling it explicitly is control: you open one session, perform several operations against it, and close it with Pop3EndSession — avoiding repeated connect/authenticate round trips and keeping deletion marks within a single, well-defined session.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oMailman
nSuccess := 0
// Demonstrates the MailMan.Pop3BeginSession method, which explicitly begins a POP3 session
// by connecting to the POP3 server and authenticating using the current POP3 property
// settings.
oMailman := CreateObject("Chilkat.MailMan")
// Configure the POP3 server connection.
oMailman:MailHost := "pop.example.com"
oMailman:MailPort := 995
oMailman:PopSsl := 1
oMailman:PopUsername := "user@example.com"
oMailman:PopPassword := "myPassword"
// Explicitly begin the POP3 session (connect + authenticate).
nSuccess := oMailman:Pop3BeginSession()
IF (nSuccess == 0)
? oMailman:LastErrorText
oMailman:destroy()
RETURN
ENDIF
// Perform one or more mailbox operations within this single session.
? "Mailbox count: " + Str(oMailman:GetMailboxCount())
// End the session when finished.
nSuccess := oMailman:Pop3EndSession()
IF (nSuccess == 0)
? oMailman:LastErrorText
oMailman:destroy()
RETURN
ENDIF
? "POP3 session completed."
oMailman:destroy()