🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Send Html Email with Indy component doesn't work

#2930
From: Francesco
Date: Thu, 22 Dec 2005 14:17
80 lines
3007 bytes

Hi,

  I want to send a html mail using SMTP of Indy 9, when i receive the
mail i see the attaches but the mail is empty, This is my code, what's
wrong?

   Thanks in advance.



  MailMessage->From->Address = "mail@mail.com";
  MailMessage->From->Name = "sender";
  MailMessage->Recipients->EMailAddresses = "info@mail.com";
    
    TStringList *Temp = new TStringList();
    Temp->LoadFromFile("c:\\mail.htm");
    MailMessage->IsEncoded = true;
    MailMessage->ContentTransferEncoding = "7bit";
    MailMessage->ContentType = "multipart/mixed"; // I've tried with
multipart/related; type="text/html" but doesn't work too
    
    TIdText *body = new TIdText(MailMessage->MessageParts, Temp);
    body->ContentType = "text/html";
    
    delete Temp;  

    //---CARICO IMMAGINE
    TIdAttachment *IImagePart3 = new
TIdAttachment(MailMessage->MessageParts, "c:\\topaug.gif");
    IImagePart3->ContentType = "image/gif";
    IImagePart3->ExtraHeaders->Values["Content-ID"] = "topaug.gif";
    IImagePart3->FileName = "topaug.gif";

    TIdAttachment *IImagePart = new
TIdAttachment(MailMessage->MessageParts, "c:\\content.gif");
    IImagePart->ContentType = "image/gif";
    IImagePart->ExtraHeaders->Values["Content-ID"] = "content.gif";
    IImagePart->FileName = "content.gif";

    TIdAttachment *IImagePart2 = new
TIdAttachment(MailMessage->MessageParts, "c:\\down.gif");
    IImagePart2->ContentType = "image/gif";
    IImagePart2->ExtraHeaders->Values["Content-ID"] = "down.gif";
    IImagePart2->FileName = "down.gif";

    .....


this is mail.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>sample</title>
</head>

<body>


	<table width="" align="center" border="0" cellSpacing=0 cellPadding=0>
<tr>
	<td><img src="cid:topaug.gif" width="662" height="155" alt=""
border="0"></td>
</tr>
<tr>
	<td><img src="cid:content.gif" width="662" height="341" alt=""
border="0"></td>
</tr>
<tr>
	<td valign="top"><img src="cid:down.gif" width="662" height="133"
alt="" border="0"></td>
</tr>
</table>


</body>
</html>
Technical Details
Message-ID: <43aac389@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsfeed.inode.at!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,9d6c4b1081b0b15,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Francesco" <>
Subject: Send Html Email with Indy component doesn't work
Newsgroups: borland.public.cppbuilder.internet.socket
User-Agent: XanaNews/1.17.5.7
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.172.212.72
Message-ID: <43aac389@newsgroups.borland.com>
Date: 22 Dec 2005 07:17:29 -0700
X-Trace: newsgroups.borland.com 1135264649 217.172.212.72 (22 Dec 2005 07:17:29 -0700)
Lines: 80
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsfeed.inode.at!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail