From 8685fba57cd3f8580a12eb5a835c96e027a39a0c Mon Sep 17 00:00:00 2001 From: Humayun Ahmed Date: Fri, 15 Mar 2019 13:46:06 +0100 Subject: [PATCH 1/2] Just followed the MimeEntity code approach to avoid non formatted content id often generated by different clients --- MimeKit/Tnef/TnefPart.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MimeKit/Tnef/TnefPart.cs b/MimeKit/Tnef/TnefPart.cs index 8bd968d944..205311ed21 100644 --- a/MimeKit/Tnef/TnefPart.cs +++ b/MimeKit/Tnef/TnefPart.cs @@ -404,7 +404,10 @@ static void ExtractAttachments (TnefReader reader, BodyBuilder builder) attachment.ContentBase = prop.ReadValueAsUri (); break; case TnefPropertyId.AttachContentId: - attachment.ContentId = prop.ReadValueAsString (); + if (MailboxAddress.TryParse(attachment.Headers.Options, prop.ReadValueAsString(), out MailboxAddress mailbox)) + attachment.ContentId = mailbox.Address; + else + attachment.ContentId = null; break; case TnefPropertyId.AttachDisposition: text = prop.ReadValueAsString (); From e66a7cf1a6249c61662d7ab8af17bac9692f193a Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 15 Mar 2019 10:09:22 -0400 Subject: [PATCH 2/2] Update TnefPart.cs Minor code cleanup / stylistic fixes. --- MimeKit/Tnef/TnefPart.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MimeKit/Tnef/TnefPart.cs b/MimeKit/Tnef/TnefPart.cs index 205311ed21..d4fcd2b3ad 100644 --- a/MimeKit/Tnef/TnefPart.cs +++ b/MimeKit/Tnef/TnefPart.cs @@ -404,10 +404,8 @@ static void ExtractAttachments (TnefReader reader, BodyBuilder builder) attachment.ContentBase = prop.ReadValueAsUri (); break; case TnefPropertyId.AttachContentId: - if (MailboxAddress.TryParse(attachment.Headers.Options, prop.ReadValueAsString(), out MailboxAddress mailbox)) + if (MailboxAddress.TryParse (prop.ReadValueAsString (), out MailboxAddress mailbox)) attachment.ContentId = mailbox.Address; - else - attachment.ContentId = null; break; case TnefPropertyId.AttachDisposition: text = prop.ReadValueAsString ();