Attachments not working after installing Indy 10 for Delphi7

Giganews Newsgroups
Subject: Attachments not working after installing Indy 10 for Delphi7
Posted by:  Alan Davies (alan.davi…@aldis-systems.co.uk)
Date: Thu, 18 Jan 2007

Hi I hope someone can help with what must be a basic error on my behalf.
I have been using previous versions for emailing attachments with no problem. After installing Version 10 I get this error even though the code is the same and previously worked. Various settings created correctly before this loop.
On the form I have a TidSMTP (SMTP) and a TidMessage (MailMessage)

[Error] MailUnit.pas(82): Undeclared identifier: 'TIdAttachment'

    while not SupplierDM.qry3.Eof
    do begin
      MailMessage.Subject:='Deliveries for '+SupplierDM.qry3['Name'];
      edAttachment.Text:=trim(SupplierDM.qry3['Code'])+'.qrp';  // extension necessary
      MailMessage.Recipients.EMailAddresses:=SupplierDM.qry3['email'];
      if FileExists(edAttachment.Text) then
      begin        //send mail if report available
// error here
        TIdAttachment.Create(Mailmessage.MessageParts, edAttachment.Text);
//
        try
          SMTP.Send(MailMessage);
        except on E:Exception do
          StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message);
        end;
      end;
      SupplierDM.qry3.Next;
    end;  //while
  finally
    if SMTP.Connected then SMTP.Disconnect;

Replies