IMAP Append – Message contains bare newlines


The Cyrus IMAP server (which is used by FastMail, FYI), is pretty picky when it comes to enforcing RFCs.  When performing a recent email migration (from Zoho, which is less picky), I got a boatload of errors along the way.

With each of my messages as individual files (downloaded as “RFC822” in raw IMAP speak), the following cleaned it up:

Although you can use sed as well, the command is not the prettiest due to the way it works with lines.

To be more thorough, this is what I ultimately placed in my PHP-based migration script:

 

Leave a comment

Your email address will not be published. Required fields are marked *