Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Nov : want to view the images only in html send by email....

www.cryer.info
Managed Newsgroup Archive

want to view the images only in html send by email....

Subject:want to view the images only in html send by email....
Posted by:"RAO" (raosistem..@globo.com)
Date:Fri, 4 Nov 2005 16:54:56

i've tried many things and i don't understand english correctly... the code
is this! what is wrong? gambit send me a link in indy components but i don't
understand very well... how can I change this code to see the image only in
the HTML sended... not in attachments.

here is the code...
----------------------------------------------------------------
function SendIndyHTMLMail(Host, FromAddr, ToAddr, Subject, FileName, User,
Pass: String; Images: TStringList): Boolean;
var
  SMTP: TIdSMTP;
  Msg: TIdMessage;
  Bdy: TIdText;
  Img: TIdAttachmentfile;
  I: Integer;
begin
  Result := False;
  SMTP := TIdSMTP.Create(Nil);
  Msg  := TIdMessage.Create(Nil);

  Msg.From.Text := FromAddr;
  Msg.Recipients.EMailAddresses := ToAddr;
  Msg.Subject := Subject;

  // Msg.ContentType := 'multipart/mixed';

  //Bdy := TIdText.Create(Msg.MessageParts);
  //Bdy.ContentType := 'text/plain';
  //Bdy.Body.Add('This mail was sent in html format. Please open the
attached file.');

  Bdy := TIdText.Create(Msg.MessageParts);
  Bdy.ContentType := 'text/html';
  Bdy.Body.LoadFromFile(FileName);
  bdy.ParentPart:=1;

  for I := 0 to Images.Count - 1 do begin
    Img := TIdAttachmentfile.Create(Msg.MessageParts, Images[I]);
    Img.ContentDisposition := 'inline';
    Img.ContentType := 'image/jpeg';
    Img.ExtraHeaders.Values['Content-ID'] := ExtractFileName(Images[I]);
    img.ParentPart:=0;
  end;


  SMTP.AuthType := atDefault; {Simple Login}
  SMTP.USERname := User;
  SMTP.Password := Pass;
  SMTP.Host     := Host;
  SMTP.Port     := 25;

  smtp.Connect;
  try
    SMTP.Send(Msg);
  finally
    Result := True;
    SMTP.Disconnect;
  end;

  Msg.Free;
  SMTP.Free;
end;

Replies:

www.cryer.info
Managed Newsgroup Archive