gpt4 book ai didi

delphi - 如何使用indy 10和delphi 7接收带有文件附件的电子邮件?

转载 作者:行者123 更新时间:2023-12-03 15:09:38 25 4
gpt4 key购买 nike

如何使用indy 10和delphi 7接收带有文件附件的电子邮件?

最佳答案

这是有效的 Indy 10 代码。 "file"是一个字符串列表,其中包含已下载的附件列表 - 我对附件感兴趣,而不是字母本身。

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;

关于delphi - 如何使用indy 10和delphi 7接收带有文件附件的电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5336984/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com