I am working with sending mails through the smtp protocol using the Indy idMessage object in delphi 7 (therefore the Indy version is 9). I was sending messages in html format without problems, but now I would like to embed an image in the body of the message. I saw that it would not be as easy as putting:
<img src='C:\Foo\image.png'>
From what I saw, you have to initialize an IdAttachment and reference it in the html, but I couldn't make it work as such.
Next I leave the code used to create the body of the message
procedure TfmMail.SendMail;
var
IdMensaje: TIdMessage;
smtp: TIdSMTP;
begin
IdMensaje := TIdMessage.Create(nil);
IdMensaje.Clear;
IdMensaje.Body.Clear;
IdMensaje.ContentType := 'text';
IdMensaje.From.Text := 'Title from email';
IdMensaje.Body.Text := 'greeting';
IdMensaje.ContentType := 'text/html';
//<img src='C:\Foo\image.png> -> Don't work
IdMensaje.Body.Text := IdMensaje.Body.Text + '<p> Other text to body </p>;