diff --git a/App/EmailProfiler.Common/clsWorkEmail.vb b/App/EmailProfiler.Common/clsWorkEmail.vb
index 1e0332f..6a3bc73 100644
--- a/App/EmailProfiler.Common/clsWorkEmail.vb
+++ b/App/EmailProfiler.Common/clsWorkEmail.vb
@@ -944,7 +944,9 @@ Public Class clsWorkEmail
Dim oAttachmentCount As Integer = 0 ' Anzahl gültige Anhänge
Dim AttachmentPosition As Integer = 0 ' Position des Anhangs in der EMail
- For Each oAttachment As MimeData In pCurrentMail.Mail.Attachments
+ Dim oAttachmentList As List(Of MimeData) = GetPurgedAttachmentList(pCurrentMail.Mail.Attachments, pAllowXMLReceipts)
+
+ For Each oAttachment As MimeData In oAttachmentList
_Logger.Info("Working on Attachment [{0}]", oAttachment.SafeFileName)
AttachmentPosition += 1
@@ -1027,6 +1029,46 @@ Public Class clsWorkEmail
End Function
+ '''
+ ''' Holt aus alle Anhängen diejenigen raus,
+ ''' die einen erlaubten Dateianhang haben
+ '''
+ '''
+ '''
+ ''' Liste der Dateien, die wir verarbeiten wollen, nothing im Fehlerfall
+ Private Function GetPurgedAttachmentList(pAttachmentList As IMimeDataReadOnlyCollection, pAllowXMLReceipts As Boolean) As List(Of MimeData)
+
+ _Logger.Debug("GetPurgedAttachmentList()")
+ Try
+
+ Dim retValue As List(Of MimeData) = New List(Of MimeData)
+ Dim oIsValidExtension As Boolean = False
+
+ For Each oAttachment As MimeData In pAttachmentList
+ Dim lowerFilename = oAttachment.SafeFileName.ToLower
+
+ If pAllowXMLReceipts = True Then
+ oIsValidExtension = _ValidFirstExtensions.Any(Function(ext) lowerFilename.EndsWith(ext))
+ Else
+ oIsValidExtension = _ValidExtensions.Any(Function(ext) lowerFilename.EndsWith(ext))
+ End If
+
+ If oIsValidExtension = True Then
+ retValue.Add(oAttachment)
+ End If
+ Next
+
+ _Logger.Debug("GetPurgedAttachmentList() retValue contains [{0}] attachments.", retValue.Count)
+
+ Return retValue
+
+ Catch ex As Exception
+ _Logger.Error(ex)
+ End Try
+
+ Return Nothing
+ End Function
+
Private Sub WorkEmbeddedAttachments(pEmailAttachment As EmailAttachment, pGDPicturePDF As GdPicturePDF)
Dim embeddedFileCount As Integer = pGDPicturePDF.GetEmbeddedFileCount()