How to attach a file to an e-mail ?

Giganews Newsgroups
Subject: How to attach a file to an e-mail ?
Posted by:  Hernán Sánchez (hernan.sanch…@iname.com)
Date: Fri, 21 Jan 2005

Hi.

I'm using Indy 10 and this is the code I have:

  IdMsgSend := TIdMessage.Create(nil);
  IdMsgSend.Body.Add(sText);
  ...
  if (sAttachments<>'') then
  begin
    TIdAttachment.Create(IdMsgSend.MessageParts, sAttachments);
  end;
  ...

Everything worked fine with Indy 9, but now with Indy 10 it shows me this
error:

"[Error] Too many actual parameters"
"[Warning] Constructing instance of 'TIdAttachment' containing abstract
method 'TIdAttachment.OpenLoadStream'"

What should I do ? does anyone has a sample on how to attach a file with
Indy 10 ?

Thanks

Hernán Sánchez

Replies