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:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Thu, 4 Oct 2007

"Peter Ypenburg" <pet…@mms.za.net> wrote in message
news:8C1E3462FE37E340pet…@mms.za.net...

>      with TIdAttachment.Create(IdMessage.MessageParts) do begin

TIdAttachment is an abstract class in Indy 10.  You can't instantiate it
directly like that.  You need to use a descendant class instead, which in
this case would be TIdAttachmentFile, ie:

    with TIdAttachmentFile.Create(IdMessage.MessageParts,
ExtractFilePath(Application.ExeName) + 'HappyBday.jpg') do begin

>        ContentLocation := ExtractFilePath(Application.ExeName);

That header has no meaning for what you are attempting.  You should not be
setting it at all.

>      IdMessage.ContentType := 'multipart/relative; type="text/html"';

Your ContentType value is wrong.  You need to change "relative" to
"related", ie:

    IdMessage.ContentType := 'multipart/related; type="text/html"';

Gambit

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