Thunderbird: moving email from local Junk folder to IMAP folder yields "Message contains invalid header"

1

1

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" 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.

Peltier

Posted 2009-09-16T09:21:48.087

Reputation: 4 834

Have you confirmed that the article indeed describes your problem? (Like by viewing the mbox files, and did you indeed ever import messages from another email client?) And what OS are you on? – Arjan – 2009-09-16T10:38:31.957

Actually I've tried a bit more, and the problem only occurs when the spam filter puts mail in my local folder, and I want to put it back.

I guess TB's junk filter adds a non-standard header to the mail. – Peltier – 2009-09-16T11:11:09.753

Hmmm, maybe as a workaround you can try to store your Junk folder on the server as well? I doubt it will result in other headers, but you could try if no helpful answers are posted. Any chance you can show the relevant headers here, as copied from an mbox file? – Arjan – 2009-09-16T11:25:16.387

ockquote>

maybe as a workaround you can try to store your Junk folder on the server as well?

It does work this way, but I'd really like to avoid storing junk on my saturated IMAP account :-/ – Peltier – 2009-09-18T11:13:24.550

Hmmm, it seems to me that the article you found (which was about problems with imported messages) does not really apply then? But of course, it does provide useful insight in how messages are stored. Maybe add the following to the question then? If Thunderbird's Junk folder is an IMAP folder on the server, then after Thunderbird has moved messages to that folder, I can move messages from Junk 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 following error: [..] – Arjan – 2009-09-18T11:29:22.757

And: please specify the OS, and the Thunderbird version. And, if possible, try to post the relevant (Junk?) headers here, as copied from an mbox file? – Arjan – 2009-09-18T11:30:35.793

Any chance that deleting (well, moving or renaming to allow for some more debugging later) the local Junk storage file solves this? Maybe Thunderbird uses existing information from the Junk folder file when adding new messages...? If that's true (very small chance) then having Thunderbird create a brand new local storage file might solve it...? – Arjan – 2009-09-18T11:41:32.683

can you please press Ctrl+U on such a message and post the headers here or somewhere else? I am not aware of any nonstandard (malformed) headers that appear automatically in junk messages. – mihi – 2009-09-18T17:08:04.440

@mihi, I doubt the headers as shown by Ctrl-U are an exact copy of how things are stored in the mbox file. So, I also doubt it will show the problem, but then: one never knows. I'd rather see the contents of the mbox file though. – Arjan – 2009-09-18T19:58:12.133

Sorry, I don't have access to my work computer now. I will post more on monday! – Peltier – 2009-09-19T08:02:18.797

@Peltier, though you already wrote the problem only occurs when the spam filter puts mail in my local folder, can you please confirm that it really only appears for the Junk folder, and not for other local folders? (The article in @harrymc's answer boldly states Thunderbird adds invalid mail headers to it's local folders, which seems to apply to non-Junk folders as well.) – Arjan – 2009-09-21T12:01:16.520

Monday, Tuesday, ... Wednesday ;-) – Arjan – 2009-09-23T08:26:45.237

Answers

2

Found this article : "Fix invalid mail headers when moving from Thunderbird to IMAP", where a Python script is proposed that fixes all mailbox files in a given directory.

Even if you don't use Python, it should be quite easy to do the same in another language or a text-editor or sed. Apparently, this fixed the problem for the author of the article.

harrymc

Posted 2009-09-16T09:21:48.087

Reputation: 306 093

What's interesting in that article is its statement Thunderbird adds invalid mail headers to it's local folders. It does, however, wrongly refer to the KB article Peltier already found, which is about If you import a folder from another email client. The script Removes ">From" and "From " lines from mail headers but Real "From:" lines have a colon and are not touched. So, this answer seems a good solution, but before applying it I'd still want to see the headers from the mbox-file. For example: I'd want to be sure that each message still has a "From" as its very first line. – Arjan – 2009-09-21T11:02:17.263

Be sure to read the comment(s) below that article! – Arjan – 2009-09-21T11:15:08.283

0

Actually, I found another thing that causes this error. I converted my Outlook mail to Thunderbird via a program called MailStore Home and in some of the results mbox files there were extraneous lines with the following

Microsoft Mail Internet Headers Version 2.0

Once I removed those lines, messages that hadn't been able to move to an IMAP folder were able to be moved.

Doug C

Posted 2009-09-16T09:21:48.087

Reputation: 1