Re: Sending a HTML email with INDY 10.2.3 for Delphi 2005 (where the bug)

Giganews Newsgroups
Subject: Re: Sending a HTML email with INDY 10.2.3 for Delphi 2005 (where the bug)
Posted by:  Khurram Zaveri (no.spam@spam.com)
Date: Mon, 8 Oct 2007

Hello,

I get the same issue when sending using 10.2.3, there is a bug wherein =
only the Last line of the HMTL/TEXT part is sent. I have requested =
support in this regard either. Please check my post in the "Socket Error =
10053" thread..=20

Here is the snippet..=20

[This is from Indy version 10.2.3.
The formed message only picks up the LAST lines from the IdText objects=20
(HTML and Text)

When I send this, the email client displays the last line of the text=20
portion of the message and the subject]

I have attached the message dumps as well.=20

Thanks
Khurram Zaveri

"Peter Ypenburg" <pet…@mms.za.net> wrote in message =
news:8C1E3462FE37E340pet…@mms.za.net...
> Hi There,
>=20
> I had an app that was sending HTML emails with embedded images and was =
using=20
> Indy 10.0.52 in Delphi 2005 and it all worked fine.
>=20
> I then upgrade to Indy 10.2.3 and now it seems like it is broken, the=20
> picture that is was an embedded image now becomes an attachment and =
the HTML=20
> does not show.
>=20
> My dilemma is that I am not sure if it is a bug in Indy or a bug in my =
code=20
> because I made changes to my code based on some of the client requests =
and=20
> now I can not get it to work.
>=20
> I had a link to a sample program sending HTML emails with Indy but I =
lost=20
> that link. Here is a simplified version of my code can some tell me if =
there=20
> is a bug in my code?
>=20
> My HTML looks like this:
> <html> <head> <title>Happy Birthday</title> </head>
> <body > <table>
> <tr> <th> <H2>Dear EMPLOYEENAME</H2> </th> </tr>
> <tr> <td> <img src=3D"cid:image1"> </td> </tr>
> </table> </body> </html>
>=20
> My code looks like this:
>      HTML :=3D TStringList.Create;
>      =
HTML.LoadFromFile(ExtractFilePath(Application.ExeName)+'HappyBirthday.htm=
');
>      IdMessage :=3D TIdMessage.Create(Self);
>      IdMessage.Subject :=3D 'Happy birthday';
>      IdMessage.Recipients.EMailAddresses :=3D =
'y…@birthday.some.place';
>      IdMessage.FromList.EMailAddresses :=3D '…@birthday.some.place';
>      IdMessage.Body.Clear;
>      IdMessage.MessageParts.Clear;
>      with TIdText.Create(IdMessage.MessageParts, nil) do
>      begin
>        Body.Text :=3D StringReplace(HTML.Text, 'EMPLOYEENAME', =
'Someone',=20
> [rfReplaceAll]);
>        ContentType :=3D 'text/html';
>      end;
>      with TIdAttachment.Create(IdMessage.MessageParts) do begin
>        ContentType :=3D 'image/jpeg';
>        ContentLocation :=3D ExtractFilePath(Application.ExeName);
>        FileName :=3D 'HappyBday.jpg';
>        ContentID :=3D 'image1';
>      end;
>      IdMessage.ContentType :=3D 'multipart/relative; =
type=3D"text/html"';
>=20
>      IdSMTP.Send(IdMessage);
>=20
> Any help is appreciated as my client needs me to give him working =
version.
>=20
> Thank you.
>=20
> --=20
> Peter
>=20
> Never ever give up,
> Hold out your cup,
> You never know when,
> You will get your zen.

Replies

In response to

Sending a HTML email with INDY 10.2.3 for Delphi 2005 (where the bug) posted by Peter Ypenburg on Thu, 4 Oct 2007