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


2006-08-18 04:27:40 PM
cppbuilder102
Thanks Remy,
I think that explains everything now.
It may be me, but I find it difficult to get what I want from
the Indy help files. I'm sure all the info is there when you
know the answers, but it is very difficult to find out what
you have to do when you don't know how it works in the first
place.
I find your explanations very helpful and I thank you for that.
All the best,
David
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote

"David Ayre" < XXXX@XXXXX.COM >wrote in message
news:44e4a6a5$ XXXX@XXXXX.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