Message with attachment puts attachment in body of mail

Giganews Newsgroups
Subject: Message with attachment puts attachment in body of mail
Posted by:  mojoala (jwarr…@jimbishopcabinets.com)
Date: Wed, 12 Dec 2007

How do you overcome this?

Prior code (Delphi6 and Indy9) worked just fine. =20

Upgraded to Delphi2007 and Indy 10 and attachments are always in some
funky code in the body of the email.

Some of the answers were to check the Email Server and Anti-virus.

Those two answers are not acceptable. =20

I should not have to worry about things I did not have worry about in =
the past.

So how do we programmatically or property-wise fix this.

TIA

Here is my code

function TDMJBCRoutines.fSetupEMailFiles(InDirectory, InFileSpec : =
String) : boolean;

var

      SearchRec: TSearchRec;

begin

    TRY

          Result :=3D False;

          with wsMsg do

            begin

                MessageParts.Clear;

                if FindFirst( InDirectory + '\' + InFileSpec, =
faAnyFile, SearchRec ) =3D 0 then

                    begin

                      Result :=3D True;

                      if (SearchRec.Name =3D '.') OR (SearchRec.Name =3D =
'..') then          =20

                      else

                            TIdAttachmentFile.Create(MessageParts, =
(InDirectory + '\' + SearchRec.Name));

                      while FindNext(SearchRec) =3D 0 do

                            begin

                              if (SearchRec.Name =3D '.') OR =
(SearchRec.Name =3D '..') then

                                else

                            TIdAttachmentFile.Create(MessageParts, =
(InDirectory + '\' + SearchRec.Name));

                            end;

                    end;

            end;

  EXCEPT

        On E: Exception do=20

            begin

                  raise;

                  ShowMessage('Attachment files FAILED!!!');      =20

                  Result :=3D False;

          end;

  END;

end;

TIA

Replies