Whenever I try to move an email from a local Junk folder to an IMAP folder in Thunderbird, I get the following error message:

> 
> The current command did not succeed. The mail server responded: Message contains invalid header
> 
> 
> 

If Thunderbird's Junk folder is an IMAP folder on the server, then after Thunderbird has moved messages to that folder, I can successfully move messages from Junk back into to some other IMAP folder. However, if the Junk folder is not on the server, then moving a message from the local Junk folder to an IMAP folder yields the aforementioned error.

The only interesting thing I've found about this error is "[Message contains invalid header](http://kb.mozillazine.org/Message_contains_invalid_header)" from the MozillaZine Knowledge Base. That article officially is about importing folders from another email client, and does not mention the Junk filter as another possible cause. However the proposed solution is not very helpful since it requires manual editing of the message box files.

Any better ideas?

EDIT: make sure you **read the comments** before answering the question.