Message contains invalid header
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:
- The current command did not succeed. The mail server responded: Message contains invalid header
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:
- From email_address timestamp
as opposed to Thunderbird's
- From - timestamp
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:
- From user@domain timestamp
- >From user@domain timestamp
- Received: ...
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 .
- Bug report about invalid header created transferring messages from local to IMAP folders
- Bug report about "Message contains invalid header" while trying to move message to IMAP account (due to header line of ">From - ...")
- Bug report about moving message from local folders back to imap server says : Message contains invalid header