4

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?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
BrunoMartinsPro
  • 1,646
  • 1
  • 24
  • 48

2 Answers2

11

What you are looking for is MimeMessage.WriteTo()

jstedfast
  • 35,744
  • 5
  • 97
  • 110
2

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));
B8ightY
  • 469
  • 5
  • 5