The latest version of the Chilkat Email component provides POP3 session management features as well as significantly improved POP3 progress monitoring and abort capability.
Any Chilkat Mail POP3-related method will automatically connect and establish a new POP3 session if one is not already active. If a POP3 session is already established, a method will use the existing session. There is no automatic disconnect when a method returns.
There are two new methods to manually establish and close POP3 sessions:
Connects to the POP3 server and authenticates. The hostname (or IP address) of the POP3 server is specified by the MailHost and MailPort properties. The PopSsl property indicates whether SSL should be used. The login name and password are specified by the PopUsername and PopPassword properties. If SPA (Secure Password Authentication) is required, the Pop3SPA property should be set.
If a POP3 session was already active, the Pop3BeginSession closes it and starts a new session.
Sends a QUIT command and closes the TCP/IP connection with the POP3 server. The QUIT command causes any message marked for delete to be deleted. Messages are marked for deletion and the connection with the POP3 server is broken before a QUIT can be issued, the messages will *not* be deleted.
There are two new MailMan properties relevant to POP3 sessions:
Commands sent to the POP3 server and the raw responses received are accumulated in this string property.
The default value of this property is true. The POP3 protocol is such that the DELE command marks a message for deletion. It is not actually deleted until the QUIT command is sent and the session is closed. If ImmediateDelete is true (non-zero), then any Chilkat MailMan method that marks a message (or messages) for deletion will also followup with a QUIT command and close the session. If your program sets ImmediateDelete to false, it must make sure to call Pop3EndSession to ensure that messages marked for deletion are actually deleted.
Some Addtional MailMan Methods (pseudo-code)
unsigned long MailMan.GetMailboxSize(void)
Returns the size in bytes of the complete maildrop (i.e. the sum of the sizes of all emails in the mailbox).
Returns the number of messages in the mailbox.
Sends a NOOP command to the POP3 server and receives the response.
If any messages have been marked for deletion, they are unmarked.
Progress Monitoring and New Events
POP3 progress monitoring and abort capability has vastly improved with this new version. Event callbacks track:
- Percent completion — The PercentDone event is fired whenever the percentage completion increments by at least one percent.
- Heartbeat (abort check) — The AbortCheck event is fired at intervals according to the HeartbeatMs property setting. If HeartbeatMs is set to 0, then no AbortCheck events are fired. The AbortCheck event provides the application with the ability to abort any Pop3 method prior to completion. The Pop3BeginSession and Pop3EndSession methods will fire AbortCheck events, but do not fire PercentDone events (because it is impossible to measure a percent completion while waiting for a TCP/IP connection to be accepted).
- EmailReceived — The EmailReceived event fires when downloading headers or full emails. After each email is received, the EmailReceived event fires and passes the following information to the application: Subject, From Address, From Name, Return Path, Date, UIDL, and Size (in bytes).