rfc2822: extract header handling from mailinfo
Extract RFC2822 from builtin/mailinfo.c

Needs checking and possibly splitting into smaller commits.
WIP