Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Delphi Indy v9代码转换为v10_Delphi_Email_Indy10 - Fatal编程技术网

将Delphi Indy v9代码转换为v10

将Delphi Indy v9代码转换为v10,delphi,email,indy10,Delphi,Email,Indy10,下面的代码引用了StoredPathName,我遇到了问题。由于Indy 10不使用StoredPathName,我不知道如何更改此代码以从V9调整到V10。下面的代码不是我写的,对于这种类型的代码,我还是一个新手,所以如果可能的话,我希望能提供一个代码示例来说明如何纠正这个问题 vlist:TStringList; ... for j:=numEmails downto 1 do begin Msg.Clear; Retrieve(j,Msg); for k:=

下面的代码引用了
StoredPathName
,我遇到了问题。由于Indy 10不使用
StoredPathName
,我不知道如何更改此代码以从V9调整到V10。下面的代码不是我写的,对于这种类型的代码,我还是一个新手,所以如果可能的话,我希望能提供一个代码示例来说明如何纠正这个问题

vlist:TStringList;

...
for j:=numEmails downto 1 do
  begin
    Msg.Clear;
    Retrieve(j,Msg);

    for k:=0 to Msg.MessageParts.Count-1 do
      with Msg.MessageParts[k] do
        if Msg.messageParts[k] is TIdAttachmentFile then
          begin
            //Get the name of the file that was sent.
            aname := TIdAttachmentFile(Msg.MessageParts[k]).FileName;

            if SameText(aname,ExtractFilename(PacketFilename))
            and FileExists(Longfilename(StoredPathName)) then
              begin
                //Read attachment and do call-back if defined.
                vlist.LoadfromFile(LongFilename(StoredPathName));

                if assigned(OnReceive) then
                  OnReceive;
              end
          end;
  end;

Disconnect;

except
  on E:Exception do
    result := E.Message;
end;
还有一段代码是<代码>连接(9000)
因为9000不是一个允许的参数,我只是将它改为
Connect可以吗?

StoredPathName是一个已从TIdMessagePart移动到TIdAttachmentFile的属性。如果您将代码更改为在顶部执行类型转换,那么所有这些都应该可以工作

更改此项:

  with Msg.MessageParts[k] do
    if Msg.messageParts[k] is TIdAttachmentFile then
致:


在Indy 9中,
Connect()
的参数是
ConnectTimeout
。在印地10号,它被移到了自己的土地上。
  if Msg.messageParts[k] is TIdAttachmentFile then
    with TIdAttachmentFile(Msg.MessageParts[k]) do