Trying to send an attachment results in a EAbstractError ?

Giganews Newsgroups
Subject: Trying to send an attachment results in a EAbstractError ?
Posted by:  Pelle F. S. Liljendal (pel…@liljendxaxl.dk)
Date: Wed, 9 Feb 2005

I have searched this forum, however it doesn't help me, so someone please
advice. I have a (so it seems) very simple problem as I can't get Indy 10 to
sent an mail wich an attachment (others can do it so I should be able to as
well). In "my real" program I sent everything up at runtime, however for now
I am "playing" with a simple test program only containing a form with a
TidSMTP and a TidMessage. For the TidSMTP I have only set the "Host"
property and for the TidSMTP I have only set properties related to who is to
receive the mail and who is the sender (work fine as long as I am not
Attaching any files).

My form also contains a button and the following code is then executed:
<SNIP>
procedure TForm1.Button1Click(Sender: TObject);
var
  MsgAttach: TidAttachment;
begin
  IdSMTP1.Connect;
  try
    MsgAttach := TidAttachment.Create(IdMessage1.MessageParts);
    MsgAttach.FileName := 'C:\Development\Delphi\Test\Indy\IndyTest.pas';
    idSMTP1.Send(IdMessage1);
  finally
    IdSMTP1.Disconnect;
  end;
end;
</SNIP>

Whenever I execute the line "idSMTP1.Send(IdMessage1);". Delphi simply
breaks with the following error: "Project IndyTestProj.exe raised exception
class EAbstractError with message 'Abstract.Error'" ???

What am I doing wrong ???

Pelle

Replies