Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TIdPOP3::RetrieveHeader question



Permlink Replies: 2 - Last Post: May 9, 2017 1:21 AM Last Post By: Asger Joergensen
Asger Joergensen

Posts: 370
Registered: 11/18/08
TIdPOP3::RetrieveHeader question
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 8, 2017 3:51 PM
Hi

I'm downloading attachments from a pop3 mailbox where only some messages
have attachment.
At the moment I use TIdPOP3::Retrieve on all new messages and then I loop
through the MessageParts if any looking for attachments of the right kind.

This works quite well, but it is rather slow the first time or if a lot of
messages have been received since last time.

So, I was wondering if it is possible, to see if there is an attachments, if
I only download the headers using TIdPOP3::RetrieveHeader and if so how ?

Thanks in advance
Best regards
Asger
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: TIdPOP3::RetrieveHeader question
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 8, 2017 4:57 PM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger wrote:

So, I was wondering if it is possible, to see if there is
an attachments, if I only download the headers using
TIdPOP3::RetrieveHeader and if so how ?

POP3 is not designed for that, you really need IMAP to do that correctly,
as it can analyze email structure and report headers of the individual parts
inside of a given email without downloading the actual bodies.

However, that being said, if an email has any non-HTML-related attachments,
its top-level "Content-Type" header should be "multipart/mixed" (but that
is not guaranteed), so you could try looking for that. But any "multipart/..."
type means the email has a complex structure to it, and that does not guarantee
attachments, so you should analyze the actual structure of the email to know
what it really contains. But POP3 can't do that, you would have to download
the complete email first.

--
Remy Lebeau (TeamB)
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: TIdPOP3::RetrieveHeader question
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 9, 2017 1:21 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Hi Remy

Thanks, I'll just leave it as it is then and hope that most people
will choose IMAP.

Best regards
Asger
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02