MimeKit and saving attachments to the computer problem

Viewed 20

I am having the same problem as it is described here: MailKit save Attachments

foreach(var attachment in message.Attachments) {
  using(var stream = File.Create("fileName")) {
    if (attachment is MessagePart) {
      var part = (MessagePart) attachment;

      part.Message.WriteTo(stream);
    } else {
      var part = (MimePart) attachment;

      part.Content.DecodeTo(stream);
    }
  }

}

and on "part.Content.DecodeTo(stream);" i get an error :

MimeKit.MimePart does not contain a definition for 'Content' and no extension method 'Content' accepting a first argument of type 'MimeKit.MimePart' could be found (are you missing a using directive or an assembly reference?)

It is driving me crazy since the only thing left for me is to save the attachment to the computer. I get the file names of the attachments, i get the correct number of attachments ...

I am not downloading emails, but doing this to an .eml file stored on computer.

Please help me out.

Thank you.

0 Answers
Related