From b42fc3ce10afe24eebad3f2c2fb85b367d59b332 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 22 Jul 2019 09:59:54 -0400 Subject: [PATCH] Fixed fetching of PreviewText items if the body's ContentTransferEncoding is NIL Fixes issue #881 --- MailKit/Net/Imap/ImapFolderFetch.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MailKit/Net/Imap/ImapFolderFetch.cs b/MailKit/Net/Imap/ImapFolderFetch.cs index 7f74ad6518..0fea09fa82 100644 --- a/MailKit/Net/Imap/ImapFolderFetch.cs +++ b/MailKit/Net/Imap/ImapFolderFetch.cs @@ -573,7 +573,10 @@ public override void Add (Section section) var charset = body.ContentType.Charset; ContentEncoding encoding; - MimeUtils.TryParse (body.ContentTransferEncoding, out encoding); + if (!string.IsNullOrEmpty (body.ContentTransferEncoding)) + MimeUtils.TryParse (body.ContentTransferEncoding, out encoding); + else + encoding = ContentEncoding.Default; using (var memory = new MemoryStream ()) { var content = new MimeContent (section.Stream, encoding);