如何解决在 ImapX 中使用 SendAndReceive()
我正在尝试有效地使用 ImapX DLL。我有 $client.Folders.Inbox.Search()
和 $client.Folders.Inbox.Messages.Download()
用于下载消息,但它们非常慢。我正在考虑使用 $client.SendAndReceive()
代替。我认为它会像 Outlook 的发送和接收一样工作,但它需要很多我不明白的参数。
这是方法定义:bool SendAndReceive(string command,[ref] System.Collections.Generic.IList[string] data,ImapX.Parsing.CommandProcessor processor,System.Text.Encoding encoding,bool pushResultToDatadespiteProcessor)
我不知道任何参数的用途。我在网上搜索了 ImapX 的文档,但找不到任何有用的信息。
SendAndReceive()
是下载消息的好方法吗?如果是这样,我该如何使用它?
这是我目前的 PowerShell 代码:
$DLL = [Reflection.Assembly]::LoadFile(“$PSScriptRoot\DLL\ImapX.dll”)
$client = New-Object ImapX.ImapClient
$client.IsDebug = $true
$client.ValidateServerCertificate = $true
$client.ThrowConnectExceptions = $true
$client.UseSsl = $false
$client.Behavior.MessageFetchMode = "Full"
$client.Host = $mailHost
$client.Port = $Port
$client.Connect()
$client.Login($user,$password)
# Downloads all messages but very slow
$client.Folders.Inbox.Search("ALL",$client.Behavior.MessageFetchMode)
$client.Folders.Inbox.Messages.Download()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。