Re. How to download email with attachment in Builder C++

Giganews Newsgroups
Subject: Re. How to download email with attachment in Builder C++
Posted by:  Elmar Baumann (elmar-nospam@anywhere.net)
Date: Mon, 16 May 2005

>chowaniec wrote in Article <419C4C3201CBE240chowanie…@poczta.onet.pl>
>with Subject: How to download email with attachment in Builder C++, on 16.05.2005 07:54:28
>
>Hi
>
>Program: Builder C++
>Component: INDY 9
>
>How to download email with attachment in Builder C++. I don't understand
>Delphy :(

Demo Code, please adjust to you project:

POP->Retrieve(int MessageNumber, TIdMessage *Msg); //Get Message from server and drop into Msg

for(intIndex = 0; intIndex < (Msg->MessageParts->Count) ;intIndex++)
{
if(dynamic_cast<TIdAttachment*>(Msg->MessageParts->Items[intIndex]))
{  //general attachment
  pnlAttachments->Visible = true;
  li = lvMessageParts->Items->Add();
  li->ImageIndex = 8;
  li->Caption = ExtractFilePath(ParamStr(0)) + dynamic_cast<TIdAttachment*>(Msg->MessageParts->Items[intIndex])->FileName;
}
else
{//body text
  if (dynamic_cast<TIdText*>(Msg->MessageParts->Items[intIndex] ))
  {
  Memo1->Lines->Clear();
  Memo1->Lines->AddStrings(dynamic_cast<TIdText*>(Msg->MessageParts->Items[intIndex])->Body);
  }
}
}

Regards

Elmar Baumann

------------------------------------------------------------------------------
Indy9 NNTP Internet News Reader/Writer, E. Baumann Software 2005

Portions of this Software are Copyright (c) 1993 - 2005,
Chad Z. Hower (Kudzu) and the Indy Pit Crew
http://www.IndyProject.org/>

Replies

In response to

How to download email with attachment in Builder C++ posted by chowaniec on Mon, 16 May 2005