diff --git a/Jobs/EDMI/ZUGFeRD/EmailFunctions.vb b/Jobs/EDMI/ZUGFeRD/EmailFunctions.vb index cb697665..9dd4c1ae 100644 --- a/Jobs/EDMI/ZUGFeRD/EmailFunctions.vb +++ b/Jobs/EDMI/ZUGFeRD/EmailFunctions.vb @@ -83,13 +83,14 @@ Public Class EmailFunctions Dim oFinalBodyText = String.Format(EmailStrings.EMAIL_WRAPPING_TEXT.Replace(EmailStrings.constNAME_ZUGFERD_PORTAL, NamePortal), oCompleteBodyText) Dim oEmailAddress = pEmailData.From - Dim oAttachment = pEmailData.Attachment - If oAttachment <> String.Empty Then - _logger.Debug($"Attachment_String [{oAttachment}]!") - If IO.File.Exists(oAttachment) = False Then - _logger.Info($"Attachment.File [{oAttachment}] is not existing!!!") + Dim oAttachmentPath = pEmailData.Attachment + If oAttachmentPath <> String.Empty Then + _logger.Debug($"Attachment_String [{oAttachmentPath}]!") + If IO.File.Exists(oAttachmentPath) = False Then + _logger.Info($"Attachment.File [{oAttachmentPath}] is not existing!!!") End If End If + Dim oAttachmentPathEscaped = oAttachmentPath.Replace("'", "''") If IsNothing(oEmailAddress) OrElse String.IsNullOrWhiteSpace(oEmailAddress) Then _logger.Warn("Could not find email-address for MessageId {0}", MessageId) @@ -133,7 +134,7 @@ Public Class EmailFunctions ,'{oFinalBodyText}' ,'{SourceProcedure}' ,'{oCreatedWho}' - ,'{oAttachment}')" + ,'{oAttachmentPathEscaped}')" _mssql.ExecuteNonQuery(oInsert) Else 'If oDTResult.Rows.Count = 0 Then