This project is read-only.

Save mail to EML

Apr 7, 2012 at 10:23 PM

Hello,

For a project a need to save email information in a grid (and here your library is great) and to save the email in eml format.

I fetch emails from the mailbox via a scheduled script using LINQ query. How can I access the orginal "raw" data from objects retrieved by the query? Or how can I sarialize again the object (which: envelop, messageinfo? ) to a file?

Thanks again for the great job

Christian

ps. I probably found a bug in ToAttachment methos: this line of code

 var bytes = !entity.IsBinary ? Encoding.UTF8.GetBytes(entity.Text) : entity.Bytes

raises an error because entity.Text qas null. I surrounded the line with a test on null, is it correct?

Apr 8, 2012 at 3:47 PM

Hi,

please create an issue and steps for recreation if possible.

the Message object has a serialization method cvalled 'ToMime()' that returns an mime string.

Apr 10, 2012 at 4:17 PM

Hi,

I'll open an issue for the "bug". Where can I send the email that raises an error?

For the main question: I've tried the method ToMime() after retreiving mail by sequential id but not all info where fetched. Now the code retrieves 100 emails blocks via linq query:

client.Messages.Where( x => x.SequenceNumber <= 100).Select(x => ...)  // client = new Imapclient()

Then I'm looping on result and save data I need in db. how can I retrieve a Message Object using this query? Or may you suggest me how to retrieve this info?

Thanks in advace for your code.

Christian F.

Apr 27, 2012 at 4:57 PM

Currently you cannot fetch the complete object using LINQ.

What you can do is call FetchMessageByUid or FetchMessageBySequenceNumber, it will download the entire message.

Alex