解决方法
这是Indy 10的代码. ‘Files’是一个字符串列表,其中包含已下载的附件列表 – 我对附件感兴趣,而不是字母本身.
with IdPop31 do begin ConnectTimeout := 5000; Connect; try files.Clear; for i := 1 to checkmessages do begin msg.clear; flag := false; if retrieve (i,msg) then begin for j := 0 to msg.MessageParts.Count-1 do begin if msg.MessageParts[j] is TIdAttachment then begin with TIdAttachment(msg.MessageParts[j]) do begin s := IncludeTrailingPathDelimiter(mydir) + ExtractFileName(FileName); log ('Downloaded ' + s); if not FileExists(s) then begin SavetoFile(s); files.Add(s); end; end; end; flag := true; end; end; end; if flag then Delete(i); // remove the email from the server end; finally disconnect; end end;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。