MimeMessage not being added to folder with IMAP

Viewed 19

I have the following function which should save a previously sent MimeMessage to the Sent folder of my mailbox. Unfortunately nothing is appended to the sent folder and no error occurs.

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

I have stepped through the code the mimeMsg indeed contains the MimeMessage object I sent. I checked sentFolder and indeed it acquired the correct iMailFolder object. Here is the imap.log:

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. First block is the Connect() call
  2. Second block is the Authenticate() call
  3. Third block is the GetFolder() call
  4. the Append() call causes no log entry
  5. Last block is the Diconnect() call

I don't understand why the server seems to totally ignore that Append() call.

1 Answers

Replacing

sentFolder.Append(mimeMsg)

with

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

solved the problem.

Not sure why this is because all examples I've seen don't mention setting flags as requirement. Could be specific the the way this IMAP server was configured. BTW, this is Rackspace's IMAP server.

Related