This project is read-only.

AppendMessage() to accept ImapX.Message

Topics: Feature Requests, Help requests
Jun 3, 2014 at 4:35 AM
Edited Jun 3, 2014 at 4:52 AM
I'm wanting to use this project as a means of copying messages from one IMAP server to the next for backup.

It is fantastic thus far to get going and I can successfully do most of what I want to do by exporting to an EML and then Importing the EML using AppendMessage on the destination server.

The issue I have is that it doesn't export Attachments this way and some of the bodies save with weird MIME type.
"This is a multipart message in MIME format". Outlook,Thunderbird and Horde don't like rendering it.
It looks to be an issue with any HTML formatted e-mail also.

If I am to use DownloadRawMessage() on the message instead of useing DownloadMessage() and asking for FULL download, it gives me a "Sequence contains no elements" exception when trying to do a ToEml()

Would it be possible to have AppendMessage() accept an ImapX.Message object directly to skip the ToString/FromString workflow? Perhaps the ToEml() is hurting some of the rich elements?
Coordinator
Jun 3, 2014 at 9:34 AM
Hi MattyBear,

the Message.ToEml method is buggy and now I'm working on migrating the library to use MimeKit. At the moment you can use the Message.DownloadRawMessage method.

From your explanation it seems that the name of the DownloadRawMessage method was a bit misleading. The method returns a string containing the EML data directly, so there is no need to call ToEml.

Here is a quick sample:
var eml = msg.DownloadRawMessage();
remoteFolder.AppendMessage(eml);
You can use it as a temporary solution until the next version is out.

Greets,

Pavel
Jun 4, 2014 at 3:59 AM

Thanks for your response!

As far as I can tell that is working – thanks for the solution.

Look forward to seeing how MimeKit turns out

-Matt