Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Nov : Winmail.dat
| Subject: | Winmail.dat |
| Posted by: | "Leif Magne Svendsen" (lem..@chello.no) |
| Date: | Thu, 24 Nov 2005 17:04:41 |
Using Indy ver 10 and Delphi 5.
I can read mails using indy's idpop3 and idmessages component. All goes
ok, but sometimes I get idText in some sort of richedit format and all
attachments are placed in winmail.dat. Why?
When I get the winmail.dat the idmessage2.MessageParts.Count is always
2, one text and one attachment.
The code are as follows:
.
.
idmessage2.Clear;
idmessage2.NoDecode := false; //True;
If IdPOP3.Retrieve(I, idmessage2) Then begin
Total := idmessage2.MessageParts.Count-1;
if total >= 0 then begin
for ii := 0 to total do begin
fContenttype := idmessage2.ContentType;
MsgPart := idmessage2.MessageParts.Items[ ii ];
if MsgPart is TIdText then begin
Sbody := TIdText( idmessage2.MessageParts.Items[ ii
]).Body ;
mailbody[ii] := sbody;
mailtype[ii] := 'T';
end
else if MsgPart is TIdAttachment then begin
try
Attachment := MsgPart as TIdAttachment;
if attachment.filename <> '' then begin
attfilename := attachment.filename;
//myfolder.attachments.item(atc).filename;
filename := inttostr(regnr)+'_'+attfilename;
filename :=
includetrailingbackslash(vedleggspath)+filename;
if fileexists(FileName) then
deletefile(FileName);
Attachment.SaveToFile( FileName );
mailtype[ii] := 'A';
inc(antattach);
fileattachment[antattach] := attfilename;
//filename;
fileattachant := antattach;
end;
except
errortyp:=8;
ACMNedlastingfeilet := true;
end;
end;
end;
end;
end;
Regards
Leif M. Svendsen