EmailProfiler.Common: Flag setzen, wenn normales attachment defekt ist.
alte Logik entfernt bzw. auskommentiert
This commit is contained in:
parent
3be1605d93
commit
c170bf7cc4
@ -1,21 +1,17 @@
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports WINDREAMLib
|
||||
Imports EmailProfiler.Common.ClassCurrent
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Threading
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Patterns
|
||||
Imports EmailProfiler.Common.ClassCurrent
|
||||
Imports GdPicture14
|
||||
Imports Limilabs.Mail
|
||||
Imports Limilabs.Mail.MIME
|
||||
Imports Limilabs.Mail.Headers
|
||||
Imports WINDREAMLib
|
||||
Imports MailBox = Limilabs.Mail.Headers.MailBox
|
||||
Imports DigitalData.Modules.Patterns
|
||||
Imports System.Data.SqlClient
|
||||
Imports GdPicture14
|
||||
Imports Limilabs.Client.IMAP
|
||||
Imports System.Net.NetworkInformation
|
||||
Imports System.Collections.Specialized.BitVector32
|
||||
|
||||
Public Class clsWorkEmail
|
||||
Private Const SUBJECT_MAX_LENGTH = 25
|
||||
@ -185,7 +181,6 @@ Public Class clsWorkEmail
|
||||
InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", oRejectionCodeString)
|
||||
AddTrackingStatusMSSQL(CurrentMail.MessageId, oRejectionCodeString, "Email-Adress validation failed", "", "EMailProfiler")
|
||||
|
||||
'AddEmailToQueueMSSQL(CurrentMail.MessageId, oResult, "Email validation failed", _EmailAccountID)
|
||||
AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "Email validation failed", _EmailAccountID,
|
||||
_RejectionTemplateId, ErrorCode.SenderValidationFailed, "", "")
|
||||
|
||||
@ -216,7 +211,6 @@ Public Class clsWorkEmail
|
||||
AddTrackingStatusMSSQL(CurrentMail.MessageId, oRejectionCodeString, "No Attachments", "", "EMailProfiler")
|
||||
|
||||
Dim oBody = EmailStrings.EMAIL_NO_FERDS
|
||||
'If AddEmailToQueueMSSQL(CurrentMail.MessageId, oBody, "No Attachments", _EmailAccountID) = True Then
|
||||
If AddToEmailQueueMSSQL(CurrentMail.MessageId, oBody, "No Attachments", _EmailAccountID,
|
||||
_RejectionTemplateId, ErrorCode.NoAttachments, "", "") = True Then
|
||||
CURRENT_ImapObject.DeleteMessageByUID(poUID)
|
||||
@ -586,7 +580,6 @@ Public Class clsWorkEmail
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
'Logger.Debug("Unexpected Error in PROCESS_MANAGER_IN: " & ex.Message & "MESSAGE_ID: " & CURRENT_MAIL_MESSAGE.MessageID)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
@ -688,7 +681,6 @@ Public Class clsWorkEmail
|
||||
|
||||
If COPY2HDD(pCurrentMail, oRow("COPY_2_HDD"), oRow("PATH_ORIGINAL"), oRow("PATH_EMAIL_ERRORS"), True) = True Then
|
||||
|
||||
'If EXTRACT_ATTACHMENTS(pCurrentMail, oExtractMainPath, oRow("PATH_EMAIL_ERRORS")) = True Then
|
||||
If ExtractAttachments(pCurrentMail, oExtractMainPath) = True Then
|
||||
Return True
|
||||
Else
|
||||
@ -703,7 +695,6 @@ Public Class clsWorkEmail
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
'Logger.Debug("Unexpected Error in PROCESS_MANAGER_IN: " & ex.Message & "MESSAGE_ID: " & CURRENT_MAIL_MESSAGE.MessageID)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
@ -730,7 +721,6 @@ Public Class clsWorkEmail
|
||||
|
||||
' Subject can be SUBJECT_MAX_LENGTH chars at most,
|
||||
' otherwise we run into errors with the path being too long
|
||||
'Dim oSubjectFilename = CURRENT_MAIL_MESSAGE.Subject.Truncate(SUBJECT_MAX_LENGTH) & ".eml"
|
||||
Dim oSubjectFilename = pCurrentMail.MessageId & ".eml"
|
||||
|
||||
oSubjectFilename = StringEx.RemoveInvalidCharacters(oSubjectFilename)
|
||||
@ -769,7 +759,6 @@ Public Class clsWorkEmail
|
||||
_Logger.Error(ex)
|
||||
_Logger.Info($"Unexpected error in Save2Temp [{oTempFilename}]")
|
||||
CurrentTempMailPath = Nothing
|
||||
'clsLogger.Add("Unexpected Error in COPY2HDD: " & ex.Message & "MESSAGE_ID: " & CURRENT_MAIL_MESSAGE.MessageID, True)
|
||||
Return False
|
||||
|
||||
End Try
|
||||
@ -778,7 +767,7 @@ Public Class clsWorkEmail
|
||||
Try
|
||||
If pShouldCopyToDisk = True Then
|
||||
_Logger.Debug("COPY_2_HDD is ACTIVE!")
|
||||
'PATH_ERROR = pPathErrors
|
||||
|
||||
If Directory.Exists(pDestination) Then
|
||||
Dim oTempFilename = Path.Combine(pDestination, $"{pCurrentMail.MessageId}.eml")
|
||||
|
||||
@ -829,7 +818,6 @@ Public Class clsWorkEmail
|
||||
If Not IsNothing(CURRENT_MAIL_BODY_ALL) Then
|
||||
Dim oRow = oTable.Rows.Item(0)
|
||||
|
||||
' CURRENT_MAIL_BODY_ALL = oMsg_email.Body
|
||||
Dim oPattern1 As String
|
||||
Dim oPattern2 As String
|
||||
Try
|
||||
@ -856,11 +844,6 @@ Public Class clsWorkEmail
|
||||
|
||||
Do While oMatch2.Success
|
||||
oClearedBodyText = oClearedBodyText.Replace(oMatch2.Value, "")
|
||||
'Dim g As Group = m.Groups(1)
|
||||
'If g.ToString.StartsWith("&") = False Then
|
||||
' TEMP_HTML_RESULTS.Add(g.ToString())
|
||||
'End If
|
||||
|
||||
oMatch2 = oMatch2.NextMatch()
|
||||
Loop
|
||||
_Logger.Debug($"Cleared bodytext after Regex2 is: {oClearedBodyText}")
|
||||
@ -915,7 +898,6 @@ Public Class clsWorkEmail
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
'clsLogger.Add("Unexpected Error in COPY2HDD: " & ex.Message & "MESSAGE_ID: " & CURRENT_MAIL_MESSAGE.MessageID, True)
|
||||
MESSAGE_ERROR = True
|
||||
Return False
|
||||
End Try
|
||||
@ -1087,6 +1069,7 @@ Public Class clsWorkEmail
|
||||
CleanUpFilePath(oFilePath)
|
||||
pAttachmentData.ErrorCodeValue = ErrorCode.NormalFileAttachmentCorrupt
|
||||
pAttachmentData.ErrorCodeComment = "Filesize is zero"
|
||||
pAttachmentData.IsAttachmentValid = False
|
||||
Return False
|
||||
End If
|
||||
|
||||
@ -1152,188 +1135,186 @@ Public Class clsWorkEmail
|
||||
Return True
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Diese Funktion wird nicht mehr verwendet!!!!
|
||||
''' </summary>
|
||||
Private Function EXTRACT_ATTACHMENTS(pCurrentMail As MailContainer, pExtractPath As String, pErrorPath As String)
|
||||
_Logger.Debug("In EXTRACT_ATTACHMENTS...")
|
||||
' MP - 15.11.2024 - Logik obsolet
|
||||
'Private Function EXTRACT_ATTACHMENTS(pCurrentMail As MailContainer, pExtractPath As String, pErrorPath As String)
|
||||
' _Logger.Debug("In EXTRACT_ATTACHMENTS...")
|
||||
|
||||
_Logger.Debug(String.Format("PATH_TEMP[{0}]", pExtractPath))
|
||||
Dim oAttachmentCount As Integer
|
||||
oAttachmentCount = 0
|
||||
TEMP_WORK_FILES.Clear()
|
||||
' _Logger.Debug(String.Format("PATH_TEMP[{0}]", pExtractPath))
|
||||
' Dim oAttachmentCount As Integer
|
||||
' oAttachmentCount = 0
|
||||
' TEMP_WORK_FILES.Clear()
|
||||
|
||||
Try
|
||||
If CurrentTempMailPath <> Nothing Then
|
||||
If File.Exists(CurrentTempMailPath) Then
|
||||
Dim oATTFilename = ""
|
||||
For Each oAttachment As MimeData In pCurrentMail.Mail.Attachments
|
||||
oATTFilename = oAttachment.SafeFileName.ToString.ToLower
|
||||
' Try
|
||||
' If CurrentTempMailPath <> Nothing Then
|
||||
' If File.Exists(CurrentTempMailPath) Then
|
||||
' Dim oATTFilename = ""
|
||||
' For Each oAttachment As MimeData In pCurrentMail.Mail.Attachments
|
||||
' oATTFilename = oAttachment.SafeFileName.ToString.ToLower
|
||||
|
||||
Dim oValidExtensions = New List(Of String) From {"pdf", "xls", "xlsx", "doc", "docx", "ppt", "pptx"}
|
||||
Dim oGraphicExtensions = New List(Of String) From {"jpg", "bmp", "jpeg", "gif", "png", "xml"}
|
||||
Dim oValidExt = oValidExtensions.Any(Function(ext) oATTFilename.EndsWith(ext))
|
||||
' Dim oValidExtensions = New List(Of String) From {"pdf", "xls", "xlsx", "doc", "docx", "ppt", "pptx"}
|
||||
' Dim oGraphicExtensions = New List(Of String) From {"jpg", "bmp", "jpeg", "gif", "png", "xml"}
|
||||
' Dim oValidExt = oValidExtensions.Any(Function(ext) oATTFilename.EndsWith(ext))
|
||||
|
||||
If oValidExt = False Then
|
||||
_Logger.Info("Invalid FileExtension [{0}]", oATTFilename)
|
||||
Dim GraphicExt = oGraphicExtensions.Any(Function(ext) oATTFilename.EndsWith(ext))
|
||||
If GraphicExt = False Then
|
||||
Dim oInfo = $"Consistency or extension of attached file {oATTFilename} is not ok."
|
||||
AddTrackingStatusMSSQL(CurrentMail.MessageId, oInfo, "PDF CONSISTENCY NOT OK", "Info GUI", "EML_PROF_EXTR_ATT1")
|
||||
AddToEmailQueueMSSQL(CurrentMail.MessageId, oInfo, "PDF CONSISTENCY NOT OK", _EmailAccountID,
|
||||
_InfoTemplateId, ErrorCode.NormalFileAttachmentCorrupt, oATTFilename, "")
|
||||
' If oValidExt = False Then
|
||||
' _Logger.Info("Invalid FileExtension [{0}]", oATTFilename)
|
||||
' Dim GraphicExt = oGraphicExtensions.Any(Function(ext) oATTFilename.EndsWith(ext))
|
||||
' If GraphicExt = False Then
|
||||
' Dim oInfo = $"Consistency or extension of attached file {oATTFilename} is not ok."
|
||||
' AddTrackingStatusMSSQL(CurrentMail.MessageId, oInfo, "PDF CONSISTENCY NOT OK", "Info GUI", "EML_PROF_EXTR_ATT1")
|
||||
' AddToEmailQueueMSSQL(CurrentMail.MessageId, oInfo, "PDF CONSISTENCY NOT OK", _EmailAccountID,
|
||||
' _InfoTemplateId, ErrorCode.NormalFileAttachmentCorrupt, oATTFilename, "")
|
||||
|
||||
End If
|
||||
Continue For
|
||||
' End If
|
||||
' Continue For
|
||||
|
||||
End If
|
||||
' End If
|
||||
|
||||
Dim oAttachmentFilePath = ""
|
||||
_Logger.Info("Working on Attachment [{0}]", oAttachment.SafeFileName)
|
||||
Try
|
||||
' Dim oAttachmentFilePath = ""
|
||||
' _Logger.Info("Working on Attachment [{0}]", oAttachment.SafeFileName)
|
||||
' Try
|
||||
|
||||
Dim oFileInfo = New FileInfo(oAttachment.SafeFileName)
|
||||
Dim oFilenameWithoutExtension = Path.GetFileNameWithoutExtension(oAttachment.SafeFileName)
|
||||
Dim oFilename = StringEx.ConvertTextToSlug(oFilenameWithoutExtension) & oFileInfo.Extension
|
||||
' Dim oFileInfo = New FileInfo(oAttachment.SafeFileName)
|
||||
' Dim oFilenameWithoutExtension = Path.GetFileNameWithoutExtension(oAttachment.SafeFileName)
|
||||
' Dim oFilename = StringEx.ConvertTextToSlug(oFilenameWithoutExtension) & oFileInfo.Extension
|
||||
|
||||
'Dim oAttachmentFileName = $"{CURRENT_MAIL_MESSAGE_ID}~{pCurrentMail.SenderDomain}~{oFilename}"
|
||||
Dim oAttachmentFileName = $"{pCurrentMail.MessageId}~Attm{oAttachmentCount}{oFileInfo.Extension}"
|
||||
' 'Dim oAttachmentFileName = $"{CURRENT_MAIL_MESSAGE_ID}~{pCurrentMail.SenderDomain}~{oFilename}"
|
||||
' Dim oAttachmentFileName = $"{pCurrentMail.MessageId}~Attm{oAttachmentCount}{oFileInfo.Extension}"
|
||||
|
||||
_Logger.Debug("Final Filename for Attachment: [{0}]", oAttachmentFileName)
|
||||
' _Logger.Debug("Final Filename for Attachment: [{0}]", oAttachmentFileName)
|
||||
|
||||
Dim oExtractTempPath = Path.Combine(pExtractPath, "Temp")
|
||||
If Directory.Exists(oExtractTempPath) = False Then
|
||||
Directory.CreateDirectory(oExtractTempPath)
|
||||
End If
|
||||
' 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)
|
||||
' oAttachmentFilePath = Path.Combine(oExtractTempPath, oAttachmentFileName)
|
||||
' _Logger.Debug("Final Path for Attachment: [{0}]", oAttachmentFilePath)
|
||||
|
||||
If File.Exists(oAttachmentFilePath) Then
|
||||
_Logger.Warn("File [{0}] already exists!", oAttachmentFilePath)
|
||||
File.Delete(oAttachmentFilePath)
|
||||
End If
|
||||
' If File.Exists(oAttachmentFilePath) Then
|
||||
' _Logger.Warn("File [{0}] already exists!", oAttachmentFilePath)
|
||||
' File.Delete(oAttachmentFilePath)
|
||||
' End If
|
||||
|
||||
_Logger.Debug(String.Format("Trying to save attachment [{0}]", oAttachmentFilePath))
|
||||
Try
|
||||
oAttachment.Save(oAttachmentFilePath)
|
||||
'oAttachment.Save(oAttachmentFileString)
|
||||
Dim oFileInfo1 As New FileInfo(oAttachmentFilePath)
|
||||
'ToDo Konsistenz prüfen
|
||||
If oFileInfo.Extension.ToLower = ".pdf" Then
|
||||
Dim oPDFConsistent As Boolean = True
|
||||
Dim oLicenseManager As New LicenseManager
|
||||
oLicenseManager.RegisterKEY(GDPictureLicense)
|
||||
' _Logger.Debug(String.Format("Trying to save attachment [{0}]", oAttachmentFilePath))
|
||||
' Try
|
||||
' oAttachment.Save(oAttachmentFilePath)
|
||||
' 'oAttachment.Save(oAttachmentFileString)
|
||||
' Dim oFileInfo1 As New FileInfo(oAttachmentFilePath)
|
||||
' 'ToDo Konsistenz prüfen
|
||||
' If oFileInfo.Extension.ToLower = ".pdf" Then
|
||||
' Dim oPDFConsistent As Boolean = True
|
||||
' Dim oLicenseManager As New LicenseManager
|
||||
' oLicenseManager.RegisterKEY(GDPictureLicense)
|
||||
|
||||
Dim oGdPicturePDF As New GdPicturePDF()
|
||||
' Lic
|
||||
Dim oStatus As GdPictureStatus = oGdPicturePDF.LoadFromFile(oAttachmentFilePath, True)
|
||||
If oStatus <> GdPictureStatus.OK Then
|
||||
oPDFConsistent = False
|
||||
Dim oResult = $"PDF-Consistency of attached file {oATTFilename} is not ok. ({oStatus.ToString})"
|
||||
AddTrackingStatusMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY NOT OK", "Info GUI", "EML_PROF_EXTR_ATT2")
|
||||
AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY NOT OK", _EmailAccountID,
|
||||
_InfoTemplateId, ErrorCode.EmbeddedFileAttachmentCorrupt, oATTFilename, "")
|
||||
File.Delete(oAttachmentFilePath)
|
||||
Continue For
|
||||
Else
|
||||
Dim embeddedFileCount As Integer = oGdPicturePDF.GetEmbeddedFileCount()
|
||||
If embeddedFileCount > 0 Then
|
||||
For i As Integer = 0 To embeddedFileCount - 1
|
||||
Dim oEmbAttName As String = oGdPicturePDF.GetEmbeddedFileName(i)
|
||||
Dim fileDetail As IO.FileInfo
|
||||
fileDetail = My.Computer.FileSystem.GetFileInfo(oEmbAttName)
|
||||
If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
Dim FileSize As Integer = oGdPicturePDF.GetEmbeddedFileSize(i)
|
||||
oValidExt = oValidExtensions.Any(Function(ext) oEmbAttName.EndsWith(ext))
|
||||
' Dim oGdPicturePDF As New GdPicturePDF()
|
||||
' ' Lic
|
||||
' Dim oStatus As GdPictureStatus = oGdPicturePDF.LoadFromFile(oAttachmentFilePath, True)
|
||||
' If oStatus <> GdPictureStatus.OK Then
|
||||
' oPDFConsistent = False
|
||||
' Dim oResult = $"PDF-Consistency of attached file {oATTFilename} is not ok. ({oStatus.ToString})"
|
||||
' AddTrackingStatusMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY NOT OK", "Info GUI", "EML_PROF_EXTR_ATT2")
|
||||
' AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY NOT OK", _EmailAccountID,
|
||||
' _InfoTemplateId, ErrorCode.EmbeddedFileAttachmentCorrupt, oATTFilename, "")
|
||||
' File.Delete(oAttachmentFilePath)
|
||||
' Continue For
|
||||
' Else
|
||||
' Dim embeddedFileCount As Integer = oGdPicturePDF.GetEmbeddedFileCount()
|
||||
' If embeddedFileCount > 0 Then
|
||||
' For i As Integer = 0 To embeddedFileCount - 1
|
||||
' Dim oEmbAttName As String = oGdPicturePDF.GetEmbeddedFileName(i)
|
||||
' Dim fileDetail As IO.FileInfo
|
||||
' fileDetail = My.Computer.FileSystem.GetFileInfo(oEmbAttName)
|
||||
' If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
' Dim FileSize As Integer = oGdPicturePDF.GetEmbeddedFileSize(i)
|
||||
' oValidExt = oValidExtensions.Any(Function(ext) oEmbAttName.EndsWith(ext))
|
||||
|
||||
If oValidExt = False Then
|
||||
_Logger.Info("Invalid FileExtension of embedded file [{0}]", oEmbAttName)
|
||||
Dim GraphicExt = oGraphicExtensions.Any(Function(ext) oEmbAttName.EndsWith(ext))
|
||||
If GraphicExt = False Then
|
||||
Dim oInfo = $"Consistency or extension of attached file [{oEmbAttName}] is not ok."
|
||||
AddTrackingStatusMSSQL(CurrentMail.MessageId, oInfo, "Extension invalid", "Info GUI", "EML_PROF_EXTR_ATT3")
|
||||
AddToEmailQueueMSSQL(CurrentMail.MessageId, oInfo, "Extension invalid", _EmailAccountID,
|
||||
_InfoTemplateId, ErrorCode.EmbeddedFileAttachmentCorrupt, oEmbAttName, "")
|
||||
End If
|
||||
Continue For
|
||||
End If
|
||||
If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
Dim FileData As Byte() = New Byte(FileSize) {}
|
||||
Dim status As GdPictureStatus = oGdPicturePDF.ExtractEmbeddedFile(0, FileData)
|
||||
If status <> GdPictureStatus.OK Or FileSize = 0 Then
|
||||
oPDFConsistent = False
|
||||
' If oValidExt = False Then
|
||||
' _Logger.Info("Invalid FileExtension of embedded file [{0}]", oEmbAttName)
|
||||
' Dim GraphicExt = oGraphicExtensions.Any(Function(ext) oEmbAttName.EndsWith(ext))
|
||||
' If GraphicExt = False Then
|
||||
' Dim oInfo = $"Consistency or extension of attached file [{oEmbAttName}] is not ok."
|
||||
' AddTrackingStatusMSSQL(CurrentMail.MessageId, oInfo, "Extension invalid", "Info GUI", "EML_PROF_EXTR_ATT3")
|
||||
' AddToEmailQueueMSSQL(CurrentMail.MessageId, oInfo, "Extension invalid", _EmailAccountID,
|
||||
' _InfoTemplateId, ErrorCode.EmbeddedFileAttachmentCorrupt, oEmbAttName, "")
|
||||
' End If
|
||||
' Continue For
|
||||
' End If
|
||||
' If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
|
||||
' Dim FileData As Byte() = New Byte(FileSize) {}
|
||||
' Dim status As GdPictureStatus = oGdPicturePDF.ExtractEmbeddedFile(0, FileData)
|
||||
' If status <> GdPictureStatus.OK Or FileSize = 0 Then
|
||||
' oPDFConsistent = False
|
||||
|
||||
Dim oResult = $"Consistency or PDF-State of embedded file [{oEmbAttName}] is not ok."
|
||||
AddTrackingStatusMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY EMBEDDED FILE NOT OK", "Info GUI", "EML_PROF_EXTR_ATT4")
|
||||
AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY EMBEDDED FILE NOT OK", _EmailAccountID,
|
||||
_InfoTemplateId, ErrorCode.EmbeddedFileAttachmentCorrupt, oEmbAttName, "")
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
' Dim oResult = $"Consistency or PDF-State of embedded file [{oEmbAttName}] is not ok."
|
||||
' AddTrackingStatusMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY EMBEDDED FILE NOT OK", "Info GUI", "EML_PROF_EXTR_ATT4")
|
||||
' AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "PDF CONSISTENCY EMBEDDED FILE NOT OK", _EmailAccountID,
|
||||
' _InfoTemplateId, ErrorCode.EmbeddedFileAttachmentCorrupt, oEmbAttName, "")
|
||||
' Continue For
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
' End If
|
||||
' End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
' End If
|
||||
|
||||
Dim oFileLength As Long = oFileInfo1.Length
|
||||
If oFileLength > 2 Then
|
||||
_Logger.Info(String.Format("Attachment saved to [{0}]", oAttachmentFilePath))
|
||||
InsertAttachmentHistoryEntry(pCurrentMail, oAttachment.SafeFileName, oAttachmentFileName)
|
||||
oAttachmentCount += 1
|
||||
Else
|
||||
_Logger.Warn($"##!! oFileLength for AttachmentObjects is <2 !!##")
|
||||
Dim oResult = $"Consistency of attached file [{oAttachment.SafeFileName}] is not ok."
|
||||
AddTrackingStatusMSSQL(CurrentMail.MessageId, oResult, "CONSISTENCY ATTACHED FILE NOT OK", "Info GUI", "EML_PROF_EXTR_ATT5")
|
||||
AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "CONSISTENCY ATTACHED FILE NOT OK", _EmailAccountID,
|
||||
_InfoTemplateId, ErrorCode.EmbeddedFileAttachmentCorrupt, oAttachment.SafeFileName, "")
|
||||
Try
|
||||
File.Delete(oAttachmentFilePath)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
' Dim oFileLength As Long = oFileInfo1.Length
|
||||
' If oFileLength > 2 Then
|
||||
' _Logger.Info(String.Format("Attachment saved to [{0}]", oAttachmentFilePath))
|
||||
' InsertAttachmentHistoryEntry(pCurrentMail, oAttachment.SafeFileName, oAttachmentFileName)
|
||||
' oAttachmentCount += 1
|
||||
' Else
|
||||
' _Logger.Warn($"##!! oFileLength for AttachmentObjects is <2 !!##")
|
||||
' Dim oResult = $"Consistency of attached file [{oAttachment.SafeFileName}] is not ok."
|
||||
' AddTrackingStatusMSSQL(CurrentMail.MessageId, oResult, "CONSISTENCY ATTACHED FILE NOT OK", "Info GUI", "EML_PROF_EXTR_ATT5")
|
||||
' AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "CONSISTENCY ATTACHED FILE NOT OK", _EmailAccountID,
|
||||
' _InfoTemplateId, ErrorCode.EmbeddedFileAttachmentCorrupt, oAttachment.SafeFileName, "")
|
||||
' Try
|
||||
' File.Delete(oAttachmentFilePath)
|
||||
' Catch ex As Exception
|
||||
' _Logger.Error(ex)
|
||||
' End Try
|
||||
' End If
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Warn($"Error while saving attachment-name: {ex.Message} - AttachmentName: {oAttachmentFilePath}")
|
||||
MESSAGE_ERROR = True
|
||||
' Catch ex As Exception
|
||||
' _Logger.Warn($"Error while saving attachment-name: {ex.Message} - AttachmentName: {oAttachmentFilePath}")
|
||||
' MESSAGE_ERROR = True
|
||||
|
||||
End Try
|
||||
' End Try
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Warn($"Error while creating and saving attachment-name: {ex.Message} - AttachmentName: {oAttachmentFilePath}")
|
||||
MESSAGE_ERROR = True
|
||||
' Catch ex As Exception
|
||||
' _Logger.Warn($"Error while creating and saving attachment-name: {ex.Message} - AttachmentName: {oAttachmentFilePath}")
|
||||
' MESSAGE_ERROR = True
|
||||
|
||||
End Try
|
||||
TEMP_WORK_FILES.Add(oAttachmentFilePath)
|
||||
Next
|
||||
Else
|
||||
_Logger.Warn($"If cause 2 EXTRACT_ATTACHMENTS: {CurrentTempMailPath} not existing")
|
||||
End If
|
||||
Else
|
||||
_Logger.Warn($"EXTRACT_ATTACHMENTSIf cause 1: CURRENT_TEMP_MAIL_PATH is NOTHING")
|
||||
End If
|
||||
CURRENT_ATTMT_COUNT = oAttachmentCount
|
||||
If MESSAGE_ERROR = True Then
|
||||
WorkTempFiles("delete")
|
||||
Return False
|
||||
' End Try
|
||||
' TEMP_WORK_FILES.Add(oAttachmentFilePath)
|
||||
' Next
|
||||
' Else
|
||||
' _Logger.Warn($"If cause 2 EXTRACT_ATTACHMENTS: {CurrentTempMailPath} not existing")
|
||||
' End If
|
||||
' Else
|
||||
' _Logger.Warn($"EXTRACT_ATTACHMENTSIf cause 1: CURRENT_TEMP_MAIL_PATH is NOTHING")
|
||||
' End If
|
||||
' CURRENT_ATTMT_COUNT = oAttachmentCount
|
||||
' If MESSAGE_ERROR = True Then
|
||||
' WorkTempFiles("delete")
|
||||
' Return False
|
||||
|
||||
Else
|
||||
WorkTempFiles("move")
|
||||
Return True
|
||||
' Else
|
||||
' WorkTempFiles("move")
|
||||
' Return True
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
MESSAGE_ERROR = True
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' _Logger.Error(ex)
|
||||
' MESSAGE_ERROR = True
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Private Sub WorkTempFiles(pAction As String)
|
||||
For Each _file In TEMP_WORK_FILES
|
||||
@ -1561,7 +1542,6 @@ Public Class clsWorkEmail
|
||||
Catch ex As Exception
|
||||
MESSAGE_ERROR = True
|
||||
_Logger.Error(ex)
|
||||
'clsLogger.Add("Unexpected Error in WORK_POLL_STEPS: " & ex.Message & "MESSAGE_ID: " & CURRENT_MAIL_MESSAGE.MessageID, True)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
@ -1582,7 +1562,6 @@ Public Class clsWorkEmail
|
||||
Catch ex As Exception
|
||||
MESSAGE_ERROR = True
|
||||
_Logger.Error(ex)
|
||||
'clsLogger.Add("Unexpected Error in WORK_INDEXING_STEPS: " & ex.Message & "MESSAGE_ID: " & CURRENT_MAIL_MESSAGE.MessageID, True)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
@ -1679,7 +1658,6 @@ Public Class clsWorkEmail
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
'clsLogger.Add("Unexpected Error in GET_DOC_INFO: " & ex.Message & "MESSAGE_ID: " & CURRENT_MAIL_MESSAGE.MessageID)
|
||||
MESSAGE_ERROR = True
|
||||
Return False
|
||||
End Try
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user