diff --git a/App/EmailProfiler.Common/clsWorkEmail.vb b/App/EmailProfiler.Common/clsWorkEmail.vb
index 9f7ce18..8a29d7a 100644
--- a/App/EmailProfiler.Common/clsWorkEmail.vb
+++ b/App/EmailProfiler.Common/clsWorkEmail.vb
@@ -167,8 +167,11 @@ Public Class clsWorkEmail
Dim oResult As String = ObjectEx.NotNull(_DB_MSSQL.GetScalarValue(pValidationSQLWithPlaceholders), "")
If oResult <> "" Then
+ Dim oRejectionCodeString = GetRejectionCodeString(CurrentMail.MessageId, ErrorCode.SenderValidationFailed)
+
'insert history und exit
- InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", oResult)
+ 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,
@@ -195,7 +198,10 @@ Public Class clsWorkEmail
If CURRENT_ATTMT_COUNT = 0 Then
_Logger.Info("### Mail contained no Attachments!! ###")
- InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", "No Attachments")
+
+ Dim oRejectionCodeString = GetRejectionCodeString(CurrentMail.MessageId, ErrorCode.NoAttachments)
+ InsertHistoryEntryWithStatus(CurrentMail, "REJECTED", oRejectionCodeString)
+ AddTrackingStatusMSSQL(CurrentMail.MessageId, oRejectionCodeString, "No Attachments", "", "EMailProfiler")
Dim oBody = EmailStrings.EMAIL_NO_FERDS
'If AddEmailToQueueMSSQL(CurrentMail.MessageId, oBody, "No Attachments", _EmailAccountID) = True Then
@@ -219,32 +225,7 @@ Public Class clsWorkEmail
Return False
End Try
End Function
- '''
- ''' Method to decide wether we use the old or the new
- ''' Rejection E-mail method.
- '''
- ''' TODO we have no information about the language of the receiver at the moment
- '''
- ''' E-Mail Message ID
- ''' Comment
- ''' Name oder Reason
- Public Function AddTrackingStatusMSSQL(pMessageId As String, pSTATE_TITLE As String, pSTATE_TITLE1 As String, pCOMMENT As String, pADDEDWHO As String) As Boolean
- Dim oInsert = $"INSERT INTO [dbo].[TBEMLP_HISTORY_STATE]
- ([MESSAGE_ID]
- ,[STATE_TITLE]
- ,[STATE_TITLE1]
- ,[COMMENT]
- ,ADDED_WHO)
- VALUES
- ('{pMessageId}'
- ,'{pSTATE_TITLE}'
- ,'{pSTATE_TITLE1}'
- ,'{pCOMMENT}'
- ,'{pADDEDWHO}')"
- Return _DB_MSSQL.ExecuteNonQuery(oInsert)
-
- End Function
'''
''' Method to decide wether we use the old or the new
''' Rejection E-mail method.
@@ -1123,6 +1104,31 @@ Public Class clsWorkEmail
End Try
End Function
+ Public Function AddTrackingStatusMSSQL(pMessageId As String, pSTATE_TITLE As String, pSTATE_TITLE1 As String, pCOMMENT As String, pADDEDWHO As String) As Boolean
+ Try
+
+ Dim oInsert =
+ $"INSERT INTO [dbo].[TBEMLP_HISTORY_STATE]
+ ([MESSAGE_ID]
+ ,[STATE_TITLE]
+ ,[STATE_TITLE1]
+ ,[COMMENT]
+ ,ADDED_WHO)
+ VALUES
+ ('{pMessageId}'
+ ,'{pSTATE_TITLE}'
+ ,'{pSTATE_TITLE1}'
+ ,'{pCOMMENT}'
+ ,'{pADDEDWHO}')"
+ Return _DB_MSSQL.ExecuteNonQuery(oInsert)
+
+ Catch ex As Exception
+ _Logger.Error(ex)
+ Return False
+ End Try
+
+ End Function
+
Private Function WORK_POLL_STEPS() As Boolean
Try
Dim oFoundSomething As Boolean = False
@@ -1320,4 +1326,16 @@ Public Class clsWorkEmail
Return Nothing
End Try
End Function
+
+ Private Function GetRejectionCodeString(pMessageId As String, pRejectionCode As ErrorCode) As String
+
+ Dim intCode As Integer = DirectCast(pRejectionCode, Integer)
+ Dim oRejectionCodeString = $"{EmailStrings.ErrorCodePraefix}{intCode}"
+
+ ' Wir wollen im error-Log den Code und die MessageID haben, um die es geht
+ Dim oInfoMessage = $"Rejection {oRejectionCodeString} triggered for '{pMessageId}'"
+ _Logger.Error(oInfoMessage)
+
+ Return oRejectionCodeString
+ End Function
End Class