Article View: borland.public.cppbuilder.internet.socket
Article #5538Re: Deleting Sent Attachments in Indy SMTP
From: Remy Lebeau (TeamB)
Date: Sun, 01 Aug 2004 20:49
Date: Sun, 01 Aug 2004 20:49
33 lines
2029 bytes
2029 bytes
"Antonio Donato" <espvida@osite.com.br> wrote in message
news:410D21DA.B5B85B81@osite.com.br...
> > if(AttachFileOne[0]!=0)
> > TIdAttachment *attachment1 = new
TIdAttachment(IndyMessage->MessageParts, AttachFileOne);
The pointer is indeed going out of scope. That code is the same as this:
if( AttachFileOne[0] != 0 )
{
TIdAttachment *attachment1 = new
TIdAttachment(IndyMessage->MessageParts, AttachFileOne);
}
You can't access the pointer from outside the if() block because it only
exists inside the if() block. You need to declare it outside the if()
block:
TIdAttachment *attachment1 = NULL;
if( AttachFileOne[0] != 0 )
attachment1 = new TIdAttachment(IndyMessage->MessageParts,
AttachFileOne);
> > RichEdit->Lines->SaveToFile(AnsiString(TmpFileAddress));
> > IndyMessage->Body->LoadFromFile(AnsiString(TmpFileAddress));
You could use SaveToStream() and LoadFromStream() instead, then you don't
need the temporary file anymore.
Gambit
Technical Details
Message-ID:
<410d5728$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<410A91BD.B2B07735@osite.com.br> <410a9542$1@newsgroups.borland.com> <410AA00A.2810F892@osite.com.br> <410ab839$1@newsgroups.borland.com> <410D21DA.B5B85B81@osite.com.br>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,7d6c5fd30befdd4b X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <410A91BD.B2B07735@osite.com.br> <410a9542$1@newsgroups.borland.com> <410AA00A.2810F892@osite.com.br> <410ab839$1@newsgroups.borland.com> <410D21DA.B5B85B81@osite.com.br> Subject: Re: Deleting Sent Attachments in Indy SMTP Date: Sun, 1 Aug 2004 13:49:35 -0700 Lines: 35 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: <410d5728$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1091393320 68.69.17.41 (1 Aug 2004 13:48:40 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail