BrunoMartinsPro
BrunoMartinsPro

Reputation: 1856

Export EML from Email using MailKit

I need to export an EML file from IMAP using Mailkit, however there are no methods to export the emails.

I didn't find any documentation either in MimeKit - Mailkit Documentation.

Is it possible to export EML files using Mailkit?

Upvotes: 5

Views: 7231

Answers (2)

B8ightY
B8ightY

Reputation: 567

If you want to write MailMessage to .eml file using MimeKit, use this code

var mimeMessage = MimeMessage.CreateFromMailMessage(mail);
mimeMessage.WriteTo(new FileStream(@"path_to_file\new_mail.eml", FileMode.Create));

Upvotes: 5

jstedfast
jstedfast

Reputation: 38643

What you are looking for is MimeMessage.WriteTo()

Upvotes: 13

Related Questions