Fix export of nested MIME messages

Thanks to Thierry Bur for the detailed reporting and testing!