Received message corrupt with SMTPServer and Indy10

Giganews Newsgroups
Subject: Received message corrupt with SMTPServer and Indy10
Posted by:  Pedro (pizquierdo20…@hotmail.com)
Date: Mon, 17 Jul 2006

Hi,

I have a SMTP server build with Indy10 (10.052) and Delphi 6.

I know that it is an old versión of indy 10 but it's work fine and this is a
critical service and I only update with just reasons. By this service great
amount of information is sent.

When I receive a message, save it to disk:

procedure TSASMTP.OnMsgReceive(ASender: TIdSMTPServerContext; AMsg: TStream;
var LAction: TIdDataReply);
var Instancia : TSAInstanciaSMTP;
    NomFich : String;
begin
  try
    LAction:=dTransactionFailed;
    Instancia:=TSAInstanciaSMTP(ASender.Data);
    If Instancia.Dest.Direccion='' then Raise
ESAException.Create(rInvalidDest);

    NomFich:=GetNomFileUnico(Instancia.DirTemp);
    TMemoryStream(AMsg).SaveToFile(NomFich);
    LAction:=dOK;
  except
    On E:Exception do OnInfo(tiError,Instancia.Id,E.Message+'
TSASMTP.OnMsgReceive');
  end;
end;

The emails that the server  receives have an attachment in Base64.

But, in three occasions that I know, in the body of mail, there are two
interchanged lines ¿?.

Example:

Original Mail:
=========

Header Mail
CR+LF
BodyLine1
BodyLine2
BodyLine3
BodyLine4
BodyLine5
BodyLine6
....

Received Mail:
==========

Header Mail
CR+LF
BodyLine1
BodyLine5  <--
BodyLine3
BodyLine4
BodyLine2 <--
BodyLine6
...

Please, need help to solve this error.

Thanks
Pedro.

Replies