🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages Started by Franz J Fortuny Wed, 21 Dec 2005 02:28
Attachments using Indy?
#3022
Author: Franz J Fortuny
Date: Wed, 21 Dec 2005 02:28
8 lines
1195 bytes
I know it must be sort of tricky and that's why I ask here:

What is the straightforward way to attach a zip file or any kind of file to 
a message being sent with INDY.

thanks,

R.O. 
Re: Attachments using Indy?
#3023
Author: Remy Lebeau (TeamB)
Date: Wed, 21 Dec 2005 03:33
12 lines
1318 bytes
"Franz J Fortuny" <fraforNOSPAM@ivsolNOSPAM.com> wrote in message
news:43a8bd6c$1@newsgroups.borland.com...

> What is the straightforward way to attach a zip file or
> any kind of file to a message being sent with INDY.

There is only one way - instantiate a TIdAttachment object, specifying the
TIdMessage::MessageParts property as the owner.


Gambit
Re: Attachments using Indy?
#2926
Author: Franz J Fortuny
Date: Wed, 21 Dec 2005 21:16
21 lines
1678 bytes
>
>> What is the straightforward way to attach a zip file or
>> any kind of file to a message being sent with INDY.
>
> There is only one way - instantiate a TIdAttachment object, specifying the
> TIdMessage::MessageParts property as the owner.

this is what I've done and seems to be working perfectly:

  if(lbAdjuns->Items->Count > 0)
  {
   for(int i=0;i<lbAdjuns->Items->Count;i++)
   {
    TIdAttachment(iMen->MessageParts,lbAdjuns->Items->Strings[i]);
   }
  }

(lbAdjuns = Attachments list box:
The items inside the ListBox are all names of files.)

Thanks, Gambit. 
Re: Attachments using Indy?
#2928
Author: Remy Lebeau (TeamB)
Date: Wed, 21 Dec 2005 22:55
26 lines
1909 bytes
"Franz J Fortuny" <fraforNOSPAM@ivsolNOSPAM.com> wrote in message
news:43a9c5de@newsgroups.borland.com...

> this is what I've done

That is not correct.  You are creating a temporary object on the stack that
goes out of scope and is freed immediately.  You must use the 'new' operator
instead to instantiate the TIdAttachment object so that it remains alive in
memory:

    new TIdAttachment(iMen->MessageParts, lbAdjuns->Items->Strings[i]);

TIdMessage will take ownership of the object and free it later on.

You should also set up the properties of the TIdAttachment as well, ie:

    TIdAttachment *attachment = new TIdAttachment(iMen->MessageParts,
lbAdjuns->Items->Strings[i]);
    attachment->ContentType =
GetMimeTypeFromFile(lbAdjuns->Items->Strings[i]);
    attachment->FileName = ExtractFileName(lbAdjuns->Items->Strings[i]);
    // etc...


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads