var
msgcount, i, J: integer;
MyTestFile:
string;
begin
msgcount:=idnntp1.MsgCount;
Memo1.Lines.Add( '
msgcount = ' + inttostr(msgcount) );
IdMessage1.ClearBody;
IdMessage1.MessageParts.Clear;
IdMessage1.Clear;
idmessage1.AttachmentTempDirectory := '
c:\temp\nzbtemp';
try
showmessage(sm.Text);
idNNTP1.GetBody(sm.Strings[0], idMessage1); <-------- 1st segment: erh5mn$rv1$4@upload.eweka.nl
except
end;
Memo1.Lines.Add( '
encoding = ' + idmessage1.AttachmentEncoding );
Memo1.Lines.Add( '
type = ' + idmessage1.ContentType );
Memo1.Lines.Add( '
transfer encoding = ' +
idmessage1.ContentTransferEncoding );
Memo1.Lines.Add( '
attachment count = ' +
IntToStr(idmessage1.MessageParts.Count) );
// dump the header
if idmessage1.Headers.Count > 0
then
for i:=0
to idmessage1.Headers.Count-1
do
Memo1.Lines.Add(idmessage1.Headers.Strings[i]);
// loop for attachments
for J := 0
to Pred( IdMessage1.MessageParts.Count )
do
begin
if ( IdMessage1.MessageParts.Items[ J ]
is TIdAttachment)
then
begin
Memo1.Lines.Add( '
** ATTACHMENT # ' + IntToStr(J) );
Memo1.Lines.Add( '
filename = ' +
TIdAttachment(IdMessage1.MessageParts.Items[ J ] ).Filename );
Memo1.Lines.Add( '
charset = ' +
TIdAttachment(IdMessage1.MessageParts.Items[ J ] ).CharSet );
Memo1.Lines.Add( '
type name = ' +
TIdAttachment(IdMessage1.MessageParts.Items[ J ] ).ContentTypeName );
Memo1.Lines.Add( '
descr = ' +
TIdAttachment(IdMessage1.MessageParts.Items[ J ] ).ContentDescription );
Memo1.Lines.Add( '
content id = ' +
TIdAttachment(IdMessage1.MessageParts.Items[ J ] ).ContentID );
Memo1.Lines.Add( '
id = ' +
IntToStr(TIdAttachment(IdMessage1.MessageParts.Items[ J ] ).ID) );
Memo1.Lines.Add( '
index = ' +
IntToStr(TIdAttachment(IdMessage1.MessageParts.Items[ J ] ).
Index) );
MyTestFile := TIdAttachment(IdMessage1.MessageParts.Items[
J ] ).Filename;
showmessage(MyTestFile);
exit; <--------------------------- hier rausgehen vor
Exception: could
not save attachment.
if fileexists(MyTestFile)
then deletefile(MyTestFile);
TIdAttachment(IdMessage1.MessageParts.Items[
J ] ).SaveToFile(MyTestFile) ; <---------------------------------------- hier wird gesaved.
end;
end;
//end; // connected
// disconnect
try
IdNNTP1.Disconnect;
except
end;
Memo1.Lines.Add('
end.');
end;