Article View: borland.public.cppbuilder.internet.socket
Article #2957Re: Send Html Email with Indy component doesn't work
From: Remy Lebeau (TeamB)
Date: Thu, 29 Dec 2005 18:55
Date: Thu, 29 Dec 2005 18:55
53 lines
3169 bytes
3169 bytes
"Francesco" <.> wrote in message news:43b3c0ba@newsgroups.borland.com...
> I cleared Indy installation and reinstalled. I created a new
> application and generated data files as you told me, unfortunately
> same result as before. :-(
After much review, it appears that Indy 9 is not capable of sending the type
of message you are attempting unless you have *2* TIdText parts in the
MessageParts collection. So add a TIdText of type 'text/plain' before the
HTML. For example:
MailMessage->From->Address = "iffbva@tin.it";
MailMessage->From->Name = "iffbva@tin.it";
MailMessage->Recipients->EMailAddresses = "iffbva@tin.it";
// ADD THIS !!!
TIdText *PlainText = new TIdText(MailMessage->MessageParts, NULL);
PlainText->Body->Text = "This message contains HTML and images.";
PlainText->ContentType = "text/plain";
TIdText *HTML = new TIdText(MailMessage->MessageParts, NULL);
HTML->Body->LoadFromFile(WPath+"\\email.htm");
HTML->ContentType = "text/html";
TIdAttachment *IImagePart = new TIdAttachment(MailMessage->MessageParts,
WPath+"\\content.gif");
IImagePart->ContentID = "content.gif";
IImagePart->ContentType = "image/gif";
IImagePart->FileName = "content.gif";
TIdAttachment *IImagePart2 = new
TIdAttachment(MailMessage->MessageParts, WPath+"\\down.gif");
IImagePart2->ContentID = "down.gif";
IImagePart2->ContentType = "image/gif";
IImagePart2->FileName = "down.gif";
TIdAttachment *IImagePart3 = new
TIdAttachment(MailMessage->MessageParts, WPath+"\\topaug.gif");
IImagePart3->ContentID = "topaug.gif";
IImagePart3->ContentType = "image/gif";
IImagePart3->FileName = "topaug.gif";
SMTP->Connect(1000);
try {
SMTP->Send(MailMessage);
}
__finally {
SMTP->Disconnect();
}
Gambit
Technical Details
Message-ID:
<43b43082$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43aac389@newsgroups.borland.com> <43aaf78e$1@newsgroups.borland.com> <43abaac3@newsgroups.borland.com> <43abdc19$3@newsgroups.borland.com> <43ac0e30@newsgroups.borland.com> <43ac59b7$1@newsgroups.borland.com> <43b0fd95@newsgroups.borland.com> <43b253e4$1@newsgroups.borland.com> <43b26f62@newsgroups.borland.com> <43b2cba7$1@newsgroups.borland.com> <43b396e1@newsgroups.borland.com> <43b3c0ba@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,9d6c4b1081b0b15 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: <43aac389@newsgroups.borland.com> <43aaf78e$1@newsgroups.borland.com> <43abaac3@newsgroups.borland.com> <43abdc19$3@newsgroups.borland.com> <43ac0e30@newsgroups.borland.com> <43ac59b7$1@newsgroups.borland.com> <43b0fd95@newsgroups.borland.com> <43b253e4$1@newsgroups.borland.com> <43b26f62@newsgroups.borland.com> <43b2cba7$1@newsgroups.borland.com> <43b396e1@newsgroups.borland.com> <43b3c0ba@newsgroups.borland.com> Subject: Re: Send Html Email with Indy component doesn't work Date: Thu, 29 Dec 2005 10:55:06 -0800 Lines: 55 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: <43b43082$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1135882370 68.69.17.41 (29 Dec 2005 10:52:50 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail