Board index » cppbuilder » Problem Sending Multipart E-mail Message
Saulo
![]() CBuilder Developer |
Problem Sending Multipart E-mail Message2005-10-26 12:23:48 PM cppbuilder57 Hi, I'm using BCB 6 with Indy 9 and I need help to send e-mails with a text/plain and text/html parts in the same message. I'm using this code but it's not working for me: SMTP->Connect(); TIdMessage *IdMessage1 = new TIdMessage(NULL); IdMessage1->IsEncoded = true; IdMessage1->ContentType = "multipart/alternative"; TIdText *aTextPart = new TIdText(IdMessage1->MessageParts,NULL); aTextPart->ContentType = "text/plain"; aTextPart->ContentTransfer = "quoted-printable"; aTextPart->Body->Add("This the plain text part!"); TIdText *aHtmlPart = new TIdText(IdMessage1->MessageParts,NULL); aHtmlPart->ContentType = "text/html"; aHtmlPart->ContentTransfer = "quoted-printable"; mStream->Position = 0; // it contains the html code part aHtmlPart->Body->LoadFromStream(mStream); ... regular stuff already tested for Recipients, Subject, FromName, ReplyTo.... SMTP->Send(IdMessage1); SMTP->Disconnect(); What could be wrong? Am I initializing the messageparts in the wrong way? Should I be using the IdMessage1->Body in some particular way? (here I'm not initializing it) Saulo I. Regis |