Article View: borland.public.cppbuilder.internet.socket
Article #3909Sending HTML mail with pictures using indy 9?
From: Paw Suddergaard
Date: Thu, 19 May 2005 10:04
Date: Thu, 19 May 2005 10:04
39 lines
2275 bytes
2275 bytes
Hi all!
Im trying to send an HTML email, with pictures (not linked but within
the email - hope you know what i mean...)
I can send the email, and the attachments. But the html come out as code...
Can anyone help please?
Here's my code:
//Send email...
try{
TStringList *TempList = new TStringList();
TempLsit->LoadFromFile(Filename);
TIdText(IdMessage->MessageParts, TempList); //just the same...
TIdText(IdMessage->MessageParts, TempList); //html
IdMessage->From->Address = FromEmail;
IdMessage->From->Name = FromName;
IdMessage->ReplyTo->EMailAddresses = FromEmail;
IdMessage->Subject = eSubject->Text;
IdMessage->Recipients->EMailAddresses = ToEMail;
TempList = FindImagesInHTML(Filename);//custom function
for(int i=0;i<TempList->Count;i++){
TIdAttachment *IImagePart = new
TIdAttachment(IdMessage->MessageParts, TempList->Strings[i]);
IImagePart->ContentType = "image/jpg";
IImagePart->Headers->Add("Content-ID:"+TempList->Strings[i]);
}
IdSMTP->Host = frmToolL->Host;
IdSMTP->Username = frmToolL->UserId;
IdSMTP->Connect();
IdSMTP->Send(IdMessage);
if(IdSMTP->Connected())
IdSMTP->Disconnect();
}
catch(...){
//some error...
}
Technical Details
Message-ID:
<428c63af@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!213.239.142.2.MISMATCH!feeder.xsnews.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,31e2e9ad50e48b5c,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 19 May 2005 12:04:33 +0200 From: Paw Suddergaard <paw@easyflex.dk> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Sending HTML mail with pictures using indy 9? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 62.242.10.214 Message-ID: <428c63af@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1116496815 62.242.10.214 (19 May 2005 03:00:15 -0700) Lines: 39 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!213.239.142.2.MISMATCH!feeder.xsnews.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail