Archived Forum Post

Index of archived forum posts

Question:

Fetch POP3 email with complete body but without attachments?

Jun 26 '12 at 18:55

I've just a simple question: is possible to fetch an email from POP3 without attachment but with the complete body? I've found only methods to get the headers or to get the complete mail, but I've not found a way to fetahc the complete body without the attachments. I want to store the email locally without attachment and download attachment on user request


Answer

This is possible with the IMAP protocol, but not with the POP3 protocol. The POP3 protocol is very simplistic in comparison to IMAP. The reason is that POP3 is intended for the purpose of downloading emails from a remote mailbox and managing the emails locally, whereas IMAP is designed with the intention that emails are going to be kept on the mail server. IMAP provides many more features for this purpose, including the ability to create/manage mailboxes, hierarchies of mailboxes, set flags, download attachments-only, move email from one mailbox to another, etc. POP3 provides none of these features. There is only an INBOX with POP3.

If you examine the POP3 protocol specification (RFC 1081) you'll find that there are only two commands for downloading an email: RETR and TOP. The RETR command downloads the entire email. The response to RETR is the complete MIME source of the email, which includes all bodies and attachments. The TOP command returns the first N raw lines of the MIME following the header. Therefore, downloading the TOP 100 lines might include only part of the text body, all of it, or maybe all of it and part of the 1st attachment, or maybe even part of the first few attachments.

In summary, Chilkat Email (POP3) cannot do what you are asking because the functionality is not available in the POP3 protocol itself. The IMAP protocol provides this functionality, and therefore Chilkat IMAP can do it.

For more detailed information about POP3 and the TOP command, see this Chilkat blog post on POP3 headers and attachment info.