🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to send an attachment to an e-mail

#2114
From: Remy Lebeau (TeamB)
Date: Thu, 17 Aug 2006 19:40
32 lines
2003 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44e4a6a5$1@newsgroups.borland.com...

> IdSMTP1->Connect(1000);
> IdSMTP1->Send(IdMessage1);
>
> if(IdSMTP1->Connected())IdSMTP1->Disconnect();

Wrap that in a try..finally block instead:

    IdSMTP1->Connect(1000);
    try {
        IdSMTP1->Send(IdMessage1);
    }
    __finally {
        IdSMTP1->Disconnect();
    }

> If I use the Text->Body->Text = acBody; as above, no
> body text appears in the body of the e-mail.

You did not set the TIdMessage::ContentType property so that the receiver
would know the formatting of the message:

    IdMessage1->ContentType = "multipart/mixed";

Also, older versions of Indy require a minimum of *2* TIdText parts - one
for plain text and one for html.


Gambit
Technical Details
Message-ID: <44e4c67d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44e2059a$1@newsgroups.borland.com> <44e213f5$1@newsgroups.borland.com> <44e2178f$1@newsgroups.borland.com> <44e2793f$1@newsgroups.borland.com> <44e2da4d$1@newsgroups.borland.com> <44e34fc7@newsgroups.borland.com> <44e48ddd$1@newsgroups.borland.com> <44e49c50$3@newsgroups.borland.com> <44e4a6a5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,f90837efd85511de
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: <44e2059a$1@newsgroups.borland.com> <44e213f5$1@newsgroups.borland.com> <44e2178f$1@newsgroups.borland.com> <44e2793f$1@newsgroups.borland.com> <44e2da4d$1@newsgroups.borland.com> <44e34fc7@newsgroups.borland.com> <44e48ddd$1@newsgroups.borland.com> <44e49c50$3@newsgroups.borland.com> <44e4a6a5$1@newsgroups.borland.com>
Subject: Re: How to send an attachment to an e-mail
Date: Thu, 17 Aug 2006 12:40:42 -0700
Lines: 34
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: <44e4c67d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1155843709 68.69.17.41 (17 Aug 2006 12:41:49 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail