Re: Trying to send an attachment results in a EAbstractError ?

Giganews Newsgroups
Subject: Re: Trying to send an attachment results in a EAbstractError ?
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Wed, 9 Feb 2005

"Pelle F. S. Liljendal" <pel…@liljendxaxl.dk (Remove the X's)> wrote in
message news:38AF260605BFE240pel…@liljendxaxl.dk...

> I have a (so it seems) very simple problem as I can't get
> Indy 10 to  sent an mail wich an attachment

TIdAttachment is an abstract base class in Indy 10.  You should not be
instantiating it directly.  You need to use one of its descendant classes
instead, such as TIdAttachmentFile, ie:.

    procedure TForm1.Button1Click(Sender: TObject);
    begin
        IdSMTP1.Connect;
        try
            TidAttachmentFile.Create(IdMessage1.MessageParts,
'C:\Development\Delphi\Test\Indy\IndyTest.pas');
            idSMTP1.Send(IdMessage1);
        finally
            IdSMTP1.Disconnect;
        end;
    end;

> 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'" ???

As well it should.  TIdAttachment has abstract methods which are not
implemented at the TIdAttachment level, but are overriden in descendants
instead.

Gambit

Replies

In response to

Trying to send an attachment results in a EAbstractError ? posted by Pelle F. S. Liljendal on Wed, 9 Feb 2005