Common: oHistoryID is not always numeric, but we need the Rejection Mail
This commit is contained in:
@@ -119,7 +119,7 @@ Public Class clsWorkEmail
|
|||||||
Dim oHistoryID = _DB_MSSQL.GetScalarValue(oSql)
|
Dim oHistoryID = _DB_MSSQL.GetScalarValue(oSql)
|
||||||
|
|
||||||
If oHistoryID > 0 Then
|
If oHistoryID > 0 Then
|
||||||
_Logger.Info($"Messsage with subject [{CURRENT_MAIL_SUBJECT}] from [{CURRENT_MAIL_FROM}] has already been worked!")
|
_Logger.Info($"Message with subject [{CURRENT_MAIL_SUBJECT}] from [{CURRENT_MAIL_FROM}] has already been worked!")
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ Public Class clsWorkEmail
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
If oTempMailAccessible = False Then
|
If oTempMailAccessible = False Then
|
||||||
_Logger.Warn("Could not process email [{0}], file does is not accessible!", CurrentMail.MessageId)
|
_Logger.Warn("Could not process email [{0}], file is not accessible!", CurrentMail.MessageId)
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ Public Class clsWorkEmail
|
|||||||
'insert history und exit
|
'insert history und exit
|
||||||
InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", oResult)
|
InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", oResult)
|
||||||
|
|
||||||
AddToEmailQueueMSSQL(CurrentMail.MessageId, oResult, "Email validation failed", _EmailAccountID)
|
AddEmailToQueueMSSQL(CurrentMail.MessageId, oResult, "Email validation failed", _EmailAccountID)
|
||||||
|
|
||||||
' Return early from processing eml
|
' Return early from processing eml
|
||||||
Return True
|
Return True
|
||||||
@@ -186,7 +186,7 @@ Public Class clsWorkEmail
|
|||||||
If CURRENT_ATTMT_COUNT = 0 Then
|
If CURRENT_ATTMT_COUNT = 0 Then
|
||||||
_Logger.Info("### Mail contained no Attachments!! ###")
|
_Logger.Info("### Mail contained no Attachments!! ###")
|
||||||
Dim oBody = EmailStrings.EMAIL_NO_FERDS
|
Dim oBody = EmailStrings.EMAIL_NO_FERDS
|
||||||
If AddToEmailQueueMSSQL(CurrentMail.MessageId, oBody, "No Attachments", _EmailAccountID) = True Then
|
If AddEmailToQueueMSSQL(CurrentMail.MessageId, oBody, "No Attachments", _EmailAccountID) = True Then
|
||||||
CURRENT_ImapObject.DeleteMessageByUID(poUID)
|
CURRENT_ImapObject.DeleteMessageByUID(poUID)
|
||||||
End If
|
End If
|
||||||
InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", "No Attachments")
|
InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", "No Attachments")
|
||||||
@@ -204,7 +204,7 @@ Public Class clsWorkEmail
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function AddToEmailQueueMSSQL(MessageId As String, BodyText As String, Comment As String, pEmailAccountId As Integer) As Boolean
|
Public Function AddEmailToQueueMSSQL(MessageId As String, BodyText As String, Comment As String, pEmailAccountId As Integer) As Boolean
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim oReference = MessageId
|
Dim oReference = MessageId
|
||||||
@@ -232,10 +232,9 @@ Public Class clsWorkEmail
|
|||||||
_Logger.Debug("To: {0}", oEmailTo)
|
_Logger.Debug("To: {0}", oEmailTo)
|
||||||
_Logger.Debug("Subject: {0}", oSubject)
|
_Logger.Debug("Subject: {0}", oSubject)
|
||||||
_Logger.Debug("Body {0}", oFinalBodyText)
|
_Logger.Debug("Body {0}", oFinalBodyText)
|
||||||
Dim osql = $"Select MAX(GUID) FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{MessageId}'"
|
Dim osql = $"Select COALESCE(MAX(GUID), 0) FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{MessageId}'"
|
||||||
Dim oHistoryID = _DB_MSSQL.GetScalarValue(osql)
|
Dim oHistoryID As Integer = _DB_MSSQL.GetScalarValue(osql)
|
||||||
|
|
||||||
If IsNumeric(oHistoryID) Then
|
|
||||||
Dim oInsert = $"INSERT INTO [dbo].[TBEMLP_EMAIL_OUT] (
|
Dim oInsert = $"INSERT INTO [dbo].[TBEMLP_EMAIL_OUT] (
|
||||||
[REMINDER_TYPE_ID]
|
[REMINDER_TYPE_ID]
|
||||||
,[SENDING_PROFILE]
|
,[SENDING_PROFILE]
|
||||||
@@ -259,13 +258,13 @@ Public Class clsWorkEmail
|
|||||||
,'{Comment}'
|
,'{Comment}'
|
||||||
,'{oCreatedWho}')"
|
,'{oCreatedWho}')"
|
||||||
Return _DB_MSSQL.ExecuteNonQuery(oInsert)
|
Return _DB_MSSQL.ExecuteNonQuery(oInsert)
|
||||||
Else
|
|
||||||
_Logger.Warn($"!! Could not get oHistoryID in AddToEmailQueueMSSQL [{osql}]")
|
|
||||||
End If
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
Return True
|
||||||
End Function
|
End Function
|
||||||
Private Function PROCESS_MANAGER_IN(pCurrentMail As MailContainer) As Boolean
|
Private Function PROCESS_MANAGER_IN(pCurrentMail As MailContainer) As Boolean
|
||||||
Try
|
Try
|
||||||
@@ -448,7 +447,7 @@ Public Class clsWorkEmail
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function SAVE2TEMP(pCurrentMail As MailContainer) As Boolean
|
Private Function SAVE2TEMP(pCurrentMail As MailContainer) As Boolean
|
||||||
Dim oTempFilename As String
|
Dim oTempFilename As String = ""
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim oTempPath As String = Path.Combine(Path.GetTempPath, "DD_EmailProfiler")
|
Dim oTempPath As String = Path.Combine(Path.GetTempPath, "DD_EmailProfiler")
|
||||||
|
|||||||
Reference in New Issue
Block a user