diff --git a/Jobs/ZUGFeRD/EmailFunctions.vb b/Jobs/ZUGFeRD/EmailFunctions.vb index 9dd4c1ae..010de5b1 100644 --- a/Jobs/ZUGFeRD/EmailFunctions.vb +++ b/Jobs/ZUGFeRD/EmailFunctions.vb @@ -1,5 +1,6 @@ Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Language Imports System.Data Imports System.IO Imports System.Data.SqlClient @@ -164,10 +165,19 @@ Public Class EmailFunctions _logger.Debug("Got Email Data for FileId {0}", MessageId) oRow = oDatatable.Rows.Item(oDatatable.Rows.Count - 1) + Dim oFromDefault = String.Format("No Sender found for ({0})", MessageId) + Dim oFrom = oRow.ItemEx("EMAIL_FROM", oFromDefault) + + Dim oAttachmentDefault = String.Format("No Attachment found for ({0})", MessageId) + Dim oAttachment = oRow.ItemEx("EMAIL_ATTMT1", oAttachmentDefault) + + Dim oSubjectDefault = String.Format("No Subject found for ({0})", MessageId) + Dim oSubject = oRow.ItemEx("EMAIL_SUBJECT", oSubjectDefault) + Return New EmailData() With { - .From = oRow.Item("EMAIL_FROM"), - .Attachment = oRow.Item("EMAIL_ATTMT1"), - .Subject = oRow.Item("EMAIL_SUBJECT") + .From = oFrom, + .Attachment = oAttachment, + .Subject = oSubject } Catch ex As Exception _logger.Warn("Could not fetch Email Data for FileId {0}", MessageId)