Message contains invalid header
From MozillaZine Knowledge Base
If you import a folder from another email client and try to copy or move a message to a remote folder it may fail with the following error message:
Thunderbird uses mbox files to store folders for POP accounts and local folders, using the mbox format. Many other email clients use mbox files, though they may have minor differences in the format. Normally this is not an issue. However, if you try to copy or move one of those messages to a folder in a IMAP account it may fail, due to invalid headers.
The invalid header was caused by the differences in the mbox format. The start of each message is located by searching for a "From" line. If a "From " string (notice the embedded space, this is not a From: header) occurs in the beginning of a line in either the headers or the message body the email client modifies it to avoid confusion. This is called "From line quoting".
The problem can occur if the other email client used a From line with a different format, for example:
as opposed to Thunderbird's
When Thunderbird sees the email address in a From line, it either prepends the line with a ">" (like its supposed to) or adds a copy of that line starting with a ">" somewhere in the headers. In either case this creates a invalid header. If you view the message source you might see:
There are other scenarios that can cause problems due to From line quoting. For example, several users have run into a similar problem copying a message from a remote folder to a local folder, and then back to the remote folder. What they all have in common is that for some reason the mbox file has lines beginning with >From. This is interpreted as a invalid header by the IMAP server when the message is uploaded.
Some IMAP servers ignore invalid headers while others don't. If yours doesn't ignore them the work around is to backup your profile, and use a text editor (not a word processor) to find and remove all of the lines in that mbox file that begin with >From .