Invalid header ("From ") during sync gmail -> icloud

49 views
Skip to first unread message

Ronald Ligteringen

unread,
Jun 4, 2014, 3:44:30 AM6/4/14
to la...@googlegroups.com
During sync from gmail to icloud for some messages I get the following error (after three retries):
[error] Net::IMAP::NoResponseError: Message contains invalid header (giving up)

In these messages the header starts with a "From " field (without the colon, not the "From:" field!). These messages are from an old client that falsely inserted this field (see rfc5322 for the specs). The error message above is generated by the icloud server and passed through via Net::IMAP (APPEND) to Larch.

Is there a way to filter out this field during the sync? Either in Larch or Net::IMAP?

Kind regards,
Ronald

Ryan Grove

unread,
Jun 4, 2014, 12:29:36 PM6/4/14
to la...@googlegroups.com
On Wed, Jun 4, 2014 at 12:44 AM, Ronald Ligteringen <r.ligt...@gmail.com> wrote:
In these messages the header starts with a "From " field (without the colon, not the "From:" field!). These messages are from an old client that falsely inserted this field (see rfc5322 for the specs). The error message above is generated by the icloud server and passed through via Net::IMAP (APPEND) to Larch.

Is there a way to filter out this field during the sync? Either in Larch or Net::IMAP?

Larch doesn't provide this functionality, but if you're comfortable with Ruby you could probably add it without too much trouble. Depending on how many messages have this problem, it might be easier to just move those messages with another mail client if you can.

- Ryan

Ronald Ligteringen

unread,
Jun 6, 2014, 4:52:01 AM6/6/14
to la...@googlegroups.com
Thanks Ryan!

I've added the following code in lib/larch.rb (line 227):
--
          if /\AFrom .*\n/ =~ msg.rfc822 
            msg.rfc822.sub!(/\AFrom .*\n/,'')
            @log.warning "[>] header starts with 'From ...'. This line is removed!"
          end
--
Works fine for me! :-)
Reply all
Reply to author
Forward
0 new messages