From 3ab200b5b233782307f7a9568ccca82f538537bb Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 10 Nov 2023 14:23:21 +0100 Subject: [PATCH] fix history entry when no attachments are found --- App/EmailProfiler.Common/clsWorkEmail.vb | 27 +++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/App/EmailProfiler.Common/clsWorkEmail.vb b/App/EmailProfiler.Common/clsWorkEmail.vb index 08c6e64..48677f1 100644 --- a/App/EmailProfiler.Common/clsWorkEmail.vb +++ b/App/EmailProfiler.Common/clsWorkEmail.vb @@ -174,21 +174,28 @@ Public Class clsWorkEmail Return PROCESS_MANAGER_IN(CurrentMail) Else + _Logger.Debug("CommonEmail-Process-Sniffer") - If COMMON_EMAIL_IN(CurrentMail) = True Then - InsertHistoryEntry(CurrentMail) - If CURRENT_ATTMT_COUNT = 0 Then - _Logger.Info("### Mail contained no Attachments!! ###") - Dim oBody = EmailStrings.EMAIL_NO_FERDS - If AddToEmailQueueMSSQL(CurrentMail.MessageId, oBody, "No Attachments", _EmailAccountID) = True Then - CURRENT_ImapObject.DeleteMessageByUID(poUID) - End If + + Dim oCommonEmailResult = COMMON_EMAIL_IN(CurrentMail) + + If oCommonEmailResult = False Then + Return False + End If + + If CURRENT_ATTMT_COUNT = 0 Then + _Logger.Info("### Mail contained no Attachments!! ###") + Dim oBody = EmailStrings.EMAIL_NO_FERDS + If AddToEmailQueueMSSQL(CurrentMail.MessageId, oBody, "No Attachments", _EmailAccountID) = True Then + CURRENT_ImapObject.DeleteMessageByUID(poUID) End If - Return True + InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", "No Attachments") Else - Return False + InsertHistoryEntry(CurrentMail) End If + Return True + End If Catch ex As Exception