4 Commits

Author SHA1 Message Date
Jonathan Jenne
ec3b6371cc Messaging: Version 1.2.8 2021-08-23 13:41:34 +02:00
Jonathan Jenne
8a31bc82db Interfaces: Version 1.5.8 2021-08-23 13:41:23 +02:00
Jonathan Jenne
9899f6867d Messaging: Correctly save emails without attachments as eml 2021-08-23 13:40:44 +02:00
Jonathan Jenne
847c7575c4 Interfaces/ZUGFeRD: log filesize with unit 2021-08-23 13:40:21 +02:00
4 changed files with 25 additions and 13 deletions

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.5.7.0")>
<Assembly: AssemblyFileVersion("1.5.7.0")>
<Assembly: AssemblyVersion("1.5.8.0")>
<Assembly: AssemblyFileVersion("1.5.8.0")>

View File

@@ -34,7 +34,7 @@ Public Class PDFEmbeds
oFileInfo = New FileInfo(FilePath)
Logger.Debug("Filename: {0}", oFileInfo.Name)
Logger.Debug("Filesize: {0}", oFileInfo.Length)
Logger.Debug("Filesize: {0} bytes", oFileInfo.Length)
Logger.Debug("Exists: {0}", oFileInfo.Exists)
Catch ex As Exception
Logger.Warn("File information for [{0}] could not be read!", FilePath)

View File

@@ -290,7 +290,7 @@ Public Class Email2
''' <returns>The path of the new EML without attachments.</returns>
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))
Dim oTempPath As String = Path.Combine(Path.GetTempPath(), Add_FilenameSuffix(pFileName, pSuffix, ".eml"))
Dim oCleanedPath As String = FileEx.GetCleanPath(oTempPath)
Dim oVersionedPath As String = FileEx.GetVersionedFilename(oCleanedPath)
Dim oEmlPath As String = MaybeConvert_MsgToEml(pFileName)
@@ -412,20 +412,28 @@ Public Class Email2
Private Function DoConvertMsgToEmlFile(pMsgFile As String) As String
Try
Logger.Debug("Converting Msg file to Eml: [{0}]", pMsgFile?.ToString)
Dim oTempPath As String = IO.Path.GetTempPath()
Dim oFileNameWithoutExtension = Path.GetFileNameWithoutExtension(pMsgFile)
Dim oFileNameWithoutInvalidChars = Language.Utils.RemoveInvalidCharacters(oFileNameWithoutExtension)
Dim oEmlPath As String = IO.Path.Combine(oTempPath, $"{oFileNameWithoutInvalidChars}.eml")
Dim oVersionedPath As String = FileEx.GetVersionedFilename(oEmlPath)
Logger.Debug("New Path for Eml file: [{0}]", oVersionedPath)
Using oConverter As New MsgConverter(pMsgFile)
Logger.Debug("Converter created")
Dim oEmail As IMail = oConverter.CreateMessage()
Logger.Debug("Message created")
Dim oData As Byte() = oEmail.Render()
Logger.Debug("Message rendered")
oEmail.Save(oVersionedPath)
Logger.Debug("Message saved")
End Using
Logger.Info("Msg File successfully converted to Eml: [{0}]", oVersionedPath)
TempFiles.Add(oVersionedPath)
Return oVersionedPath
@@ -437,16 +445,20 @@ Public Class Email2
End Try
End Function
Private Function Add_FilenameSuffix(pFilename As String, pSuffix As String)
Private Function Add_FilenameSuffix(pFilename As String, pSuffix As String, Optional pExtension As String = Nothing)
Dim oFileInfo As New FileInfo(pFilename)
Dim oExtension As String = oFileInfo.Extension
If pExtension IsNot Nothing Then
If pExtension.StartsWith(".") = False Then
oExtension = $".{pExtension}"
Else
oExtension = pExtension
End If
End If
Dim oFileNameWithoutExtension = Path.GetFileNameWithoutExtension(pFilename)
Return $"{oFileNameWithoutExtension}{pSuffix}{oExtension}"
End Function
End Class

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2.7.0")>
<Assembly: AssemblyFileVersion("1.2.7.0")>
<Assembly: AssemblyVersion("1.2.8.0")>
<Assembly: AssemblyFileVersion("1.2.8.0")>