Compare commits

...

3 Commits

3 changed files with 30 additions and 26 deletions

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("")> <Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("DigitalData.EMLProfiler")> <Assembly: AssemblyProduct("DigitalData.EMLProfiler")>
<Assembly: AssemblyCopyright("Copyright © 2024")> <Assembly: AssemblyCopyright("Copyright © 2024")>
<Assembly: AssemblyTrademark("2.15.0.0")> <Assembly: AssemblyTrademark("3.0.1.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.0.0.0")> <Assembly: AssemblyVersion("3.0.1.0")>
<Assembly: AssemblyFileVersion("3.0.0.0")> <Assembly: AssemblyFileVersion("3.0.1.0")>

View File

@ -13,7 +13,6 @@ Imports MailBox = Limilabs.Mail.Headers.MailBox
Imports DigitalData.Modules.Patterns Imports DigitalData.Modules.Patterns
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports GdPicture14 Imports GdPicture14
Imports System.Net.WebRequestMethods
Imports Limilabs.Client.IMAP Imports Limilabs.Client.IMAP
Public Class clsWorkEmail Public Class clsWorkEmail
@ -132,7 +131,7 @@ Public Class clsWorkEmail
Return True Return True
End If End If
Dim oTempMailExists As Boolean = SAVE2TEMP(CurrentMail) Dim oTempMailExists As Boolean = Save2TempDirectory(CurrentMail)
'Checking wether Mail can be opened 'Checking wether Mail can be opened
Dim oTempMailAccessible As Boolean = False Dim oTempMailAccessible As Boolean = False
@ -143,7 +142,7 @@ Public Class clsWorkEmail
End If End If
Try Try
Dim oFS As FileStream = System.IO.File.OpenRead(CurrentTempMailPath) Dim oFS As FileStream = File.OpenRead(CurrentTempMailPath)
oTempMailAccessible = True oTempMailAccessible = True
oFS.Close() oFS.Close()
Catch ex As Exception Catch ex As Exception
@ -610,7 +609,7 @@ Public Class clsWorkEmail
End Try End Try
End Function End Function
Private Function SAVE2TEMP(pCurrentMail As MailContainer) As Boolean Private Function Save2TempDirectory(pCurrentMail As MailContainer) As Boolean
Dim oTempFilename As String = "" Dim oTempFilename As String = ""
Try Try
@ -624,7 +623,7 @@ Public Class clsWorkEmail
Dim oFileName As String Dim oFileName As String
For Each oFileName In oFileEntries For Each oFileName In oFileEntries
Try Try
System.IO.File.Delete(oFileName) File.Delete(oFileName)
Catch ex As Exception Catch ex As Exception
End Try End Try
Next oFileName Next oFileName
@ -646,7 +645,7 @@ Public Class clsWorkEmail
Dim oCounter As Integer = 1 Dim oCounter As Integer = 1
Dim oCancel As Boolean Dim oCancel As Boolean
Do While System.IO.File.Exists(CurrentTempMailPath) = False Do While File.Exists(CurrentTempMailPath) = False
_Logger.Debug("Trying to read saved mail.. ({0}/{1})", oCounter, 10) _Logger.Debug("Trying to read saved mail.. ({0}/{1})", oCounter, 10)
Thread.Sleep(1000) Thread.Sleep(1000)
oCounter += 1 oCounter += 1
@ -659,7 +658,7 @@ Public Class clsWorkEmail
If oCancel = True Then If oCancel = True Then
oResult = False oResult = False
Else Else
If System.IO.File.Exists(CurrentTempMailPath) Then If File.Exists(CurrentTempMailPath) Then
oResult = True oResult = True
End If End If
End If End If
@ -684,7 +683,7 @@ Public Class clsWorkEmail
If Directory.Exists(pDestination) Then If Directory.Exists(pDestination) Then
Dim oTempFilename = Path.Combine(pDestination, $"{pCurrentMail.MessageId}.eml") Dim oTempFilename = Path.Combine(pDestination, $"{pCurrentMail.MessageId}.eml")
If System.IO.File.Exists(oTempFilename) = False Then If File.Exists(oTempFilename) = False Then
pCurrentMail.Mail.Save(oTempFilename) pCurrentMail.Mail.Save(oTempFilename)
@ -697,7 +696,7 @@ Public Class clsWorkEmail
Else Else
_Logger.Warn("FileLenth of file [{0}] is 0! File will be deleted.", oTempFilename) _Logger.Warn("FileLenth of file [{0}] is 0! File will be deleted.", oTempFilename)
Try Try
System.IO.File.Delete(oTempFilename) File.Delete(oTempFilename)
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
End Try End Try
@ -832,7 +831,7 @@ Public Class clsWorkEmail
Try Try
If CurrentTempMailPath <> Nothing Then If CurrentTempMailPath <> Nothing Then
If System.IO.File.Exists(CurrentTempMailPath) Then If File.Exists(CurrentTempMailPath) Then
Dim oATTFilename = "" Dim oATTFilename = ""
For Each oAttachment As MimeData In pCurrentMail.Mail.Attachments For Each oAttachment As MimeData In pCurrentMail.Mail.Attachments
oATTFilename = oAttachment.SafeFileName.ToString.ToLower oATTFilename = oAttachment.SafeFileName.ToString.ToLower
@ -868,12 +867,17 @@ Public Class clsWorkEmail
_Logger.Debug("Final Filename for Attachment: [{0}]", oAttachmentFileName) _Logger.Debug("Final Filename for Attachment: [{0}]", oAttachmentFileName)
oAttachmentFilePath = Path.Combine(pExtractPath, "Temp", oAttachmentFileName) Dim oExtractTempPath = Path.Combine(pExtractPath, "Temp")
If Directory.Exists(oExtractTempPath) = False Then
Directory.CreateDirectory(oExtractTempPath)
End If
oAttachmentFilePath = Path.Combine(oExtractTempPath, oAttachmentFileName)
_Logger.Debug("Final Path for Attachment: [{0}]", oAttachmentFilePath) _Logger.Debug("Final Path for Attachment: [{0}]", oAttachmentFilePath)
If System.IO.File.Exists(oAttachmentFilePath) Then If File.Exists(oAttachmentFilePath) Then
_Logger.Warn("File [{0}] already exists!", oAttachmentFilePath) _Logger.Warn("File [{0}] already exists!", oAttachmentFilePath)
System.IO.File.Delete(oAttachmentFilePath) File.Delete(oAttachmentFilePath)
End If End If
_Logger.Debug(String.Format("Trying to save attachment [{0}]", oAttachmentFilePath)) _Logger.Debug(String.Format("Trying to save attachment [{0}]", oAttachmentFilePath))
@ -892,7 +896,7 @@ Public Class clsWorkEmail
AddTrackingStatusMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY NOT OK", "Info GUI", "EML_PROF_EXTR_ATT2") AddTrackingStatusMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY NOT OK", "Info GUI", "EML_PROF_EXTR_ATT2")
AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY NOT OK", _EmailAccountID, AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY NOT OK", _EmailAccountID,
_InfoTemplateId, ErrorCode.PDFStructureCorrupt, oATTFilename, "") _InfoTemplateId, ErrorCode.PDFStructureCorrupt, oATTFilename, "")
System.IO.File.Delete(oAttachmentFilePath) File.Delete(oAttachmentFilePath)
Continue For Continue For
Else Else
Dim embeddedFileCount As Integer = oGdPicturePDF.GetEmbeddedFileCount() Dim embeddedFileCount As Integer = oGdPicturePDF.GetEmbeddedFileCount()
@ -950,7 +954,7 @@ Public Class clsWorkEmail
AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "CONSISTENCY ATTACHED FILE NOT OK", _EmailAccountID, AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "CONSISTENCY ATTACHED FILE NOT OK", _EmailAccountID,
_InfoTemplateId, ErrorCode.PDFStructureCorrupt, oAttachment.SafeFileName, "") _InfoTemplateId, ErrorCode.PDFStructureCorrupt, oAttachment.SafeFileName, "")
Try Try
System.IO.File.Delete(oAttachmentFilePath) File.Delete(oAttachmentFilePath)
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
End Try End Try
@ -994,18 +998,18 @@ Public Class clsWorkEmail
End Function End Function
Private Sub WorkTempFiles(pACT As String) Private Sub WorkTempFiles(pACT As String)
For Each _file In TEMP_WORK_FILES For Each _file In TEMP_WORK_FILES
_Logger.Debug("Working on temp work file: [{0}]", _file) _Logger.Debug("Working ({0}) on temp work file: [{1}]", pACT, _file)
If IO.File.Exists(_file) Then If File.Exists(_file) Then
If pACT = "Delete" Then If pACT = "Delete" Then
Try Try
IO.File.Delete(_file) File.Delete(_file)
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
_Logger.Warn("Could not delete the tempworkfile : [{0}]", _file) _Logger.Warn("Could not delete the tempworkfile : [{0}]", _file)
End Try End Try
ElseIf pACT = "move" Then ElseIf pACT = "move" Then
IO.File.Move(_file, _file.Replace("\Temp", "")) File.Move(_file, _file.Replace("\Temp", ""))
End If End If
End If End If
@ -1017,7 +1021,7 @@ Public Class clsWorkEmail
If MESSAGE_ERROR = False Then If MESSAGE_ERROR = False Then
Return InsertHistoryEntryWithStatus(pCurrentMail, String.Empty, String.Empty) Return InsertHistoryEntryWithStatus(pCurrentMail, String.Empty, String.Empty)
Else Else
_Logger.Info("! No INSERT_HISTORY as MessageError = True") _Logger.Info("No INSERT_HISTORY as MessageError = True")
Return False Return False
End If End If
End Function End Function

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("")> <Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("SERV_EMAIL")> <Assembly: AssemblyProduct("SERV_EMAIL")>
<Assembly: AssemblyCopyright("Copyright © 2024")> <Assembly: AssemblyCopyright("Copyright © 2024")>
<Assembly: AssemblyTrademark("2.15.0.0")> <Assembly: AssemblyTrademark("3.0.1.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.15.0.0")> <Assembly: AssemblyVersion("3.0.1.0")>
<Assembly: AssemblyFileVersion("2.10.0.0")> <Assembly: AssemblyFileVersion("3.0.1.0")>