MimeMessage未添加到IMAP文件夹中



我有以下功能,它应该将以前发送的MimeMessage保存到我邮箱的sent文件夹中。不幸的是,没有任何内容附加到已发送的文件夹,也没有发生任何错误。

Public Sub SaveMessageToSent(account As String, password As String, mimeMsg As MimeKit.MimeMessage)
Using client = New MailKit.Net.Imap.ImapClient(New MailKit.ProtocolLogger("c:imap.log"))
client.Connect(My.Settings.Secure_Email_Server, My.Settings.Secure_IMAP_Port, True)
client.Authenticate(account, password)
Dim sentFolder = client.GetFolder("INBOX.Sent")
sentFolder.Append(mimeMsg)
client.Disconnect(True)
End Using
End Sub

我已经逐步完成了mimeMsg确实包含我发送的MimeMessage对象的代码。我检查了sentFolder,它确实获得了正确的iMailFolder对象。这是图像日志:

Connected to imaps://secure.emailsrvr.com:993/
S: * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN] Server ready proxy11.mail.ord1d.rsapps.net
C: A00000000 AUTHENTICATE PLAIN ********
S: A00000000 OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY STATUS=SIZE SAVEDATE LITERAL+ NOTIFY SPECIAL-USE QUOTA ACL RIGHTS=texk] Logged in
C: A00000001 NAMESPACE
S: * NAMESPACE (("INBOX." ".")) NIL NIL
S: A00000001 OK Namespace completed (0.001 + 0.000 secs).
C: A00000002 LIST "" "INBOX" RETURN (SUBSCRIBED CHILDREN)
S: * LIST (Subscribed HasChildren) "." INBOX
S: A00000002 OK List completed (0.003 + 0.000 + 0.002 secs).
C: A00000003 LIST (SPECIAL-USE) "" "*" RETURN (SUBSCRIBED CHILDREN)
S: A00000003 OK List completed (0.001 + 0.000 + 0.001 secs).
C: A00000004 LIST "" INBOX.Sent RETURN (SUBSCRIBED CHILDREN)
S: * LIST (Subscribed HasNoChildren UnMarked) "." INBOX.Sent
S: A00000004 OK List completed (0.002 + 0.000 + 0.001 secs).
Nothing?!?!
C: A00000005 LOGOUT
S: * BYE Logging out
S: A00000005 OK Logout completed (0.001 + 0.000 secs).
  1. 第一个块是Connect((调用
  2. 第二个块是Authenticate((调用
  3. 第三个块是GetFolder((调用
  4. Append((调用不会导致日志条目
  5. 最后一个块是Diconnect((调用

我不明白为什么服务器似乎完全忽略了Append((调用。

更换

sentFolder.Append(mimeMsg)

带有

sentFolder.Append(New MailKit.AppendRequest(mimeMsg, MailKit.MessageFlags.None))

解决了问题。

不知道为什么会这样,因为我看到的所有例子都没有提到将设置标志作为要求。可能特定于IMAP服务器的配置方式。顺便说一句,这是Rackspace的IMAP服务器。

相关内容

  • 没有找到相关文章

最新更新