Re: Receive mail with attachment (indy 9)

Giganews Newsgroups
Subject: Re: Receive mail with attachment (indy 9)
Posted by:  Remy Lebeau \(TeamB\) (
Date: Thu, 27 Mar 2008

"duf" <d…> wrote in message news:032B60F8CD4DE340d…

> I cannot find code for receive mail with attachment.

Have you looked at the demos on Indy's website yet?

> I try do it with something like this:

Why are you clearing the TIdMessage after downloading it but before
accessing its content?  You need to stop doing that.

> I do not know how can I get name of attachment ( zal_nazwa )
> and how to save file.

You have not read the documentation yet, have you?

        ilosc_wiad = POP3Client->CheckMessages();
        for(int i = 1; i <= ilosc_wiad; ++i)
            POP3Client->Retrieve(i, IdMessage1);
            for(int j = 0; j < IdMessage1->MessageParts->Count-1; ++j)
                TIdAttachment *Attachment =
                if( Attachment )
                    // use Attachment as needed.  It has a FileName
                    // property and SaveToFile() method available...



In response to

Receive mail with attachment (indy 9) posted by duf on Thu, 27 Mar 2008