Ein leeres Subject führt offensichtlich zu unverarbeiteten E-Mails. Variable und deren Logging geprüft und abgesichert

This commit is contained in:
PitzM 2025-10-01 09:43:01 +02:00
parent db06af6a37
commit d7c2c86a00

View File

@ -101,11 +101,11 @@ Public Class clsWorkEmail
'TODO: Move all of these CURRENT_MAIL vars into a business object of type mail container
_CurrentMail = New MailContainer(pMailMessage, poUID)
_Logger.Debug($"Working on email from: {CURRENT_MAIL_FROM}...Subject: {pMailMessage.Subject}")
CURRENT_MAIL_BODY_ALL = ""
CURRENT_MAIL_BODY_ANSWER1 = ""
CURRENT_MAIL_BODY_Substr2 = ""
CURRENT_MAIL_SUBJECT = pMailMessage.Subject.ToUpper.EscapeForSQL()
_Logger.Info($"Working on email from: {_CurrentMail.SenderAddress} - Subject: {_CurrentMail.Subject} - MessageID: {_CurrentMail.MessageId}")
CURRENT_MAIL_BODY_ALL = String.Empty
CURRENT_MAIL_BODY_ANSWER1 = String.Empty
CURRENT_MAIL_BODY_Substr2 = String.Empty
CURRENT_MAIL_SUBJECT = String.Empty
CURRENT_MAIL_UID = poUID
@ -134,19 +134,19 @@ Public Class clsWorkEmail
'
'End If
If IsNothing(CURRENT_MAIL_SUBJECT) Then
CURRENT_MAIL_SUBJECT = ""
If IsNothing(_CurrentMail.Subject) Then
CURRENT_MAIL_SUBJECT = String.Empty
_Logger.Warn("Subject was nothing!")
Else
_Logger.Debug("Subject: [{0}]", CURRENT_MAIL_SUBJECT)
CURRENT_MAIL_SUBJECT = _CurrentMail.Subject.ToUpper.EscapeForSQL()
_Logger.Debug("Fixed Subject: [{0}]", CURRENT_MAIL_SUBJECT)
End If
_Logger.Info($"Working on email from : {CURRENT_MAIL_FROM}...")
Dim oSql = $"Select COALESCE(MAX(GUID),0) FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{_CurrentMail.MessageId}'"
Dim oHistoryID = _DB_MSSQL.GetScalarValue(oSql)
If oHistoryID > 0 And IS_LOCAL_TEST = False Then
_Logger.Info($"Message with subject [{CURRENT_MAIL_SUBJECT}] from [{CURRENT_MAIL_FROM}] has already been worked!")
_Logger.Info($"Message with subject [{_CurrentMail.SubjectOriginal}] from [{_CurrentMail.SenderAddress}] has already been worked!")
Return True
End If
@ -538,7 +538,7 @@ Public Class clsWorkEmail
Try
_Logger.Info(String.Format("PM-related message found....[{0}]", pCurrentMail.Mail.Subject))
_Logger.Debug(String.Format("PM-related message found....[{0}]", pCurrentMail.Mail.Subject))
Dim oExpression = "PROCESS_NAME = 'ProcessManager'"
'Filter the rows using Select() method of DataTable
Dim TEMP_PROCESS_PROFILE_DT As DataTable = DT_POLL_PROCESS