HTML Mail with images embedded (almost done)

Giganews Newsgroups
Subject: HTML Mail with images embedded (almost done)
Posted by:  Moctezuma Sandoval (unisolucion…@terra.com.mx)
Date: Tue, 23 Mar 2004

Hi you all,

I've followed some threads in this newsgroup to make an e-mail with images
embedded, I have done succesfully, except for one thing, the images embedded
are being received by the mail client (MS Outlook, Hotmail) as file
attachments, the place where they goes is showed as a blank box, if I select
Modify message from the MS Outlook contextual menu, and then press Forward
the new mail has the correct look, may be there is a property which I don't
know that must be set in TIdMessage, I'm pasting mi actual code, any help
would be appreciated.

...
  Main.Msg.IsEncoded  := True;
  Main.Msg.ContentType := 'multipart/mixed';
  with TIdText.Create(Main.Msg.MessageParts, nil) do begin
    ContentType := 'text/plain';
    Body.Text := 'Cotizacion Les Croissants';
  end;
  with TIdText.Create(Main.Msg.MessageParts, nil) do begin
    ContentType := 'text/html';
    Body.LoadFromFileBaseFileName+'.htm');
  end;

    Attachments := TStringList.Create;
    try
      ListFiles(sysTempPath,'*.jpg',Attachments,True);
      for i:= 0 to (Attachments.Count-1) do begin
        with TIdAttachment.Create(Main.Msg.MessageParts,
Attachments.Strings[i]) do
        begin
          FileName  := ExtractFileName(Attachments.Strings[i]);
          ContentType:= 'image/jpeg';
          ContentDisposition := 'inline';
        end;
      end;
    finally
      Attachments.Free;
    end;  // try/finally

  with Main.Msg do
      begin
        From.Text                    := Main.NombreEjecutivo;
        Sender.Address            := UserEmail;
        ReplyTo.EMailAddresses  := UserEmail;
        Recipients.EMailAddresses := E_mail;
        Subject := Asunto;
        Priority := mpNormal;
        CCList.EMailAddresses := '';
        BccList.EMailAddresses := UserEMail;
      end;

  case SmtpAuthType of
      0: Main.SMTP.AuthenticationType := atNone;
      1: Main.SMTP.AuthenticationType := atLogin;
  end;
  Main.SMTP.Username := SmtpServerUser;
  Main.SMTP.Password := SmtpServerPassword;
  Main.SMTP.Host := SmtpServerName;
  Main.SMTP.Port := SmtpServerPort;

  OldCursor:= Screen.Cursor;
  Screen.Cursor := crHourGlass;
  Main.SMTP.Connect;
  try
      Main.SMTP.Send(Main.Msg);
  finally
      Main.SMTP.Disconnect;
    Screen.Cursor := OldCursor;
  end;
...

I'm using D6, Indy 9.0.14, WinXP, MS Outlook 2002

Thanks in advance.
Mocte

Replies