Re: Received message corrupt with SMTPServer and Indy10

Giganews Newsgroups
Subject: Re: Received message corrupt with SMTPServer and Indy10
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Mon, 17 Jul 2006

"Pedro" <pizquierdo20…@hotmail.com> wrote in message
news:C14A8E427200E340pizquierdo20…@hotmail.com...

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

That is an old build of Indy 10.  Please upgrade to the 10.1.5 snapshot and
see if the problem still exists.

> I know that it is an old versión of indy 10 but it's work fine

Obviously not, or you wouldn't be having problems with it.

>    TMemoryStream(AMsg).SaveToFile(NomFich);

You should not be making assumptions about the types that Indy uses
internally.  If TIdSMTPServer is ever updated to use something other than
TMemoryStream, your code would fail.  Rather than type-casting, you should
use a separate TFileStream instead.  Then it won't matter what TStream type
Indy uses internally.  For example:

    with TFileStream.Create(NomFich, fmCreate) do
    try
        CopyFrom(AMsg, 0);
    finally
        Free;
    end;

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

What you describe is only possible if that is the way the SMTP client is
sending the data to begin with.  TIdSMTPServer stores the received data
as-is into the TStream without any parsing of the data at all (other than
some minimal processing to satisfy SMTP's transport rules, but that has no
effect on what you have described).  If you look at the raw SMTP socket
traffic through a packet sniffer, you should be seeing the raw data appear
that way on the socket.  That is the only way it can end up like that when
stored by Indy.

Gambit

Replies

None

In response to

Received message corrupt with SMTPServer and Indy10 posted by Pedro on Mon, 17 Jul 2006