From 3d39d7303b64d8120d173ff7189348ac5e1f89d8 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Mon, 23 Aug 2021 14:15:11 +0200 Subject: [PATCH] Messaging: fix Remove_AttachmentsfromEmail not creating eml files --- Modules.Messaging/Email2.vb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Modules.Messaging/Email2.vb b/Modules.Messaging/Email2.vb index 5d88ead1..4dd5f177 100644 --- a/Modules.Messaging/Email2.vb +++ b/Modules.Messaging/Email2.vb @@ -290,12 +290,18 @@ Public Class Email2 ''' The path of the new EML without attachments. Public Function Remove_AttachmentsFromEmail(pFileName As String, Optional pSuffix As String = "") As String Try - Dim oTempPath As String = Path.Combine(Path.GetTempPath(), Add_FilenameSuffix(pFileName, pSuffix, ".eml")) + ' Convert possible msg file to eml + Dim oEmlPath As String = MaybeConvert_MsgToEml(pFileName) + + ' Clean and version new path + Dim oTempPath As String = Path.Combine(Path.GetTempPath(), Add_FilenameSuffix(oEmlPath, pSuffix, ".eml")) Dim oCleanedPath As String = FileEx.GetCleanPath(oTempPath) Dim oVersionedPath As String = FileEx.GetVersionedFilename(oCleanedPath) - Dim oEmlPath As String = MaybeConvert_MsgToEml(pFileName) + + ' Load eml file Dim oMail = MailBuilder.CreateFromEmlFile(oEmlPath) + ' Remove attachments and save oMail.RemoveAttachments() oMail.Save(oVersionedPath)