附件下载下来都成打不开的文件了。
附上我写的下载段源码:
procedure TConnect_download.Downloadnewmail_writedailyrecord(Sender:TObject);
var
index,loop:integer;
path:string;
temp:TMemoryStream;
begin
for index:=1 to POP.SessionMessageCount do
begin
Show2.Caption:='开始从'+mailmanageini.ReadString('mail','host','')+'接收第'+inttostr(index)+'封邮件....';
POP.RetrieveMessage(index);
if Msg.AttachList.Count>0 then
begin
for Loop := 0 to Msg.AttachList.Count-1 do
begin
path:=ExtractFilePath(ParamStr(0))+'AFP\'+Msg.AttachList[loop].FileName;
temp:=TMemoryStream.Create;
Msg.AttachList[loop].Decoded.SaveToStream(temp);
temp.Position:=0;
temp.SaveToFile(path);
Msg.AttachList[loop].SaveToFile(path);
end;
Msg.Reset;
end;
end;
Show2.Caption:='邮件接收完成';
Show_dailyrecord(Sender);
end;
达人指点是怎么回事。
附上我写的下载段源码:
procedure TConnect_download.Downloadnewmail_writedailyrecord(Sender:TObject);
var
index,loop:integer;
path:string;
temp:TMemoryStream;
begin
for index:=1 to POP.SessionMessageCount do
begin
Show2.Caption:='开始从'+mailmanageini.ReadString('mail','host','')+'接收第'+inttostr(index)+'封邮件....';
POP.RetrieveMessage(index);
if Msg.AttachList.Count>0 then
begin
for Loop := 0 to Msg.AttachList.Count-1 do
begin
path:=ExtractFilePath(ParamStr(0))+'AFP\'+Msg.AttachList[loop].FileName;
temp:=TMemoryStream.Create;
Msg.AttachList[loop].Decoded.SaveToStream(temp);
temp.Position:=0;
temp.SaveToFile(path);
Msg.AttachList[loop].SaveToFile(path);
end;
Msg.Reset;
end;
end;
Show2.Caption:='邮件接收完成';
Show_dailyrecord(Sender);
end;
达人指点是怎么回事。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货