Problem reading mail send with Indy (8.0.22) to an Exchange server

Hi all,

When I send an email containing some lines in the body and one attachment to
an Exchange server, the body of the email is allways empty. The attachment
is there allright. When I send the same email to other mailservers the email
contains both the body lines as the attachment.

What goes wrong?

Here is part of my sample application:

procedure TForm1.btnButton1Click(Sender: TObject);
Var
  hRecipient: TIdEmailAddressItem;
begin
  With msgFBZ Do
  Begin
    Clear;

    IsEncoded := True;

    Sender.Name := edtEdit1.Text;
    Sender.Address := edtEdit1.Text;
    From.Name := 'Ben Pottiez';
    From.Address := edtEdit1.Text;
    Date := Date;

    hRecipient := Recipients.Add;
    hRecipient.Address := edtEdit2.Text;

    Subject := edtEdit3.Text;

    TIdText.Create( MessageParts, mmoMemo1.Lines );
    TIdText.Create( MessageParts ); {Must be here else error while sending
mail}

    If FileExists( rxfedtFilenameEdit1.FileName ) Then
    Begin
      TIdAttachment.Create( MessageParts, rxfedtFilenameEdit1.FileName );
    End;
  End;

  With smtpFBZ Do
  Begin
    Host := edtEdit4.Text;
    UserId := edtEdit5.Text;
    If ( edtEdit6.Text <> '' ) Then
    Password := edtEdit6.Text;
    If Not Connected Then
      Connect;
    If Connected Then
    Begin
      Send( msgFBZ );
      Disconnect;
    End;
  End;
end;

Also, if you have a look at my code, you will notice that I have to add an
extra messagepart TidText with an empty body. If not I receive an error:
'Invalid Text count. TIdText must be greater than 1'. Is this correct?

Please post your responds in this newsgroup and send a copy of your respond
to me by email (as I'm not able to check this newgroup at a regular time):
Ben_Pott...@PeopleWare.be

--
Ben Pottiez
PeopleWare

http://www.PeopleWare.be
i...@PeopleWare.be

It's amazing what one can accomplish
when one doesn't know
what one can't do...