POP3 message encoding error

Giganews Newsgroups
Subject: POP3 message encoding error
Posted by:  Michele Minorello (_t_D4723278…@newsread.albacom.net)
Date: Mon, 2 May 2005

I'm currently using Indy 10 and VS (VB.NET), and when I save the RAW
incoming messages there are a lot of problems with the encoding of the
message.
The message is not left as the original but it is modified!

Example:

Original message:

To:  te…@domain.com
Subject: number 1
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

òç°àì  <- The problem is this!!!

Saved  message:

Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

rg`0^l    <- The problem is this!!!

I've converted and tested the code with Delphi 2005 Update2 and the problem
persists.
Where am I wrong? Code follows...

Thanks,
Michele

procedure TForm1.SaveMessages;
var
LocalPath: string;
TextLines: TStringList;
iMessageFound, iMsgNo: integer;
begin
        POP3Connection.Host := '192.168.1.2' ;
        POP3Connection.Username := 'test' ;
        POP3Connection.Password := 'test';
        LocalPath := 'c:\incoming\';
        POP3Connection.Connect();

            iMessageFound := POP3Connection.CheckMessages;

                    for iMsgNo := 1 to iMessageFound do
                    begin
                        TextLines := TStringList.Create;
                        POP3Connection.RetrieveRaw(iMsgNo, TextLines) ;
                        TextLines.SaveToFile(localPath+'email_'+iMsgNo.ToString+'.eml');
                        FreeAndNil( TextLines);
                    end;
end;

Replies