WIP Rename Inbox files to eml files

This commit is contained in:
Jonathan Jenne 2022-02-02 16:25:59 +01:00
parent 2101f51816
commit 527b15c01c

View File

@ -27,6 +27,28 @@ Public Class ClassFilehandle
Dim oTempFilePath = pFilepath
Dim oInboxRegex As New Regex("\.INBOX\d+$")
If oInboxRegex.IsMatch(oTempFilePath) Then
LOGGER.Info("Renaming INBOX file to EML")
Try
Dim oInfo As New FileInfo(oTempFilePath)
LOGGER.Info("Old Name: {0}", oInfo.Name)
Dim oNewName = $"{oInfo.Name}.eml"
LOGGER.Info("New Name: {0}", oNewName)
Dim oTempDirectory = IO.Path.GetTempPath()
Dim oNewPath = IO.Path.Combine(oTempDirectory, oNewName)
IO.File.Copy(oInfo.Name, oNewPath)
TEMP_FILES.Add(oNewPath)
oTempFilePath = oNewPath
Catch ex As Exception
LOGGER.Error(ex)
End Try
End If
If oTempFilePath.ToUpper.EndsWith(".MSG") Or oTempFilePath.ToUpper.EndsWith(".EML") Then
CURRENT_MESSAGEID = ""
Dim oMail As IMail = EMAIL.Load_Email(oTempFilePath)