Search code examples
emailimappostfix-mta

What does the IMAP response "+ OK" mean?


I am working on an internal email migration tool, and I am using IMAP to copy email from one server to another. However, I have hit a bug where the server (running Postfix) seems to be responding with + OK to a command and then my program hangs.

Here is the sequence of events. I try to APPEND a message to the new server:

yaWmXw APPEND INBOX (\Seen \receiptchecked \Answered) " 5-Oct-2015 22:33:11 +0000" {37020}

The new server doesn't understand the \receiptchecked flag so it objects:

yaWmXw BAD Error in IMAP command APPEND: Invalid system flag \RECEIPTCHECKED (0.000 + 0.000 secs).

I remove the offending flag and try again:

uoTzlA APPEND INBOX (\Seen \Answered) " 5-Oct-2015 22:33:11 +0000" {37020}

And then the server responds with the enigmatic + OK and my program hangs. What does the + OK mean? How should I handle it? I can't find any mention of it online.

In case it is relevant, here are the server's capabilities:

* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS LOGINDISABLED]

Solution

  • + is "Go ahead, send your data.", that is, the 37020 bytes your promised you were going to send. Everything after that is just freeform text.