|Subject:||Re: Attachments and POP3->Delete|
|Posted by:||Remy Lebeau \(TeamB\) (email@example.com)|
|Date:||Sat, 27 Sep 2008|
"duf" <d…@wp.pl> wrote in message news:1A7A14259064E340d…@wp.pl...
> But there is problem when I receive one message with two attachments.
That is because you are calling Delete() too many times. You are calling it
every time you encounter an individual attachment, when you should be
calling it only one time for the entire message instead. That is a bug in
your code, not in TIdPOP3. You need to add the following to your code to
for( int i = 1; i <= Form1->news; ++i )
Form1->POP3->Retrieve( i, Form1->IdMessage1 );
for( int j = 0; j < Form1->IdMessage1->MessageParts->Count; ++j )
TIdAttachment *Attachment = dynamic_cast<TIdAttachment*>(
if( Attachment )
Form1->POP3->Delete( i );
break; // <-- add this!!
Remy Lebeau (TeamB)
Attachments and POP3->Delete posted by duf on Thu, 25 Sep 2008