🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #2928

Re: Attachments using Indy?

#2928
From: 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
Technical Details
Message-ID: <43a9dd56$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43a8bd6c$1@newsgroups.borland.com> <43a8cd1b$1@newsgroups.borland.com> <43a9c5de@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,38646c715cb8dd31
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <43a8bd6c$1@newsgroups.borland.com> <43a8cd1b$1@newsgroups.borland.com> <43a9c5de@newsgroups.borland.com>
Subject: Re: Attachments using Indy?
Date: Wed, 21 Dec 2005 14:55:29 -0800
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <43a9dd56$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1135205718 68.69.17.41 (21 Dec 2005 14:55:18 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail