Fix subject with single quotes

This commit is contained in:
Jonathan Jenne 2022-11-02 13:00:44 +01:00
parent 9178a3784c
commit 4beff2f34d
2 changed files with 8 additions and 5 deletions

View File

@ -26,6 +26,7 @@ Public Class clsEmailIMAP
oListuids = _limilab.IMAPGetMessageIDs_AllMails() oListuids = _limilab.IMAPGetMessageIDs_AllMails()
If IsNothing(oListuids) Then If IsNothing(oListuids) Then
Logger.Warn("List of UIDs was Nothing. Returning False.")
Return False Return False
Else Else
If oListuids.Count > 0 Then If oListuids.Count > 0 Then
@ -35,8 +36,10 @@ Public Class clsEmailIMAP
Else Else
Logger.Debug("FetchIMAPMessagesLimilab - No Emails found!") Logger.Debug("FetchIMAPMessagesLimilab - No Emails found!")
End If End If
Return True
End If End If
Return True
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
Return False Return False

View File

@ -66,7 +66,7 @@ Public Class clsWorkEmail
CURRENT_MAIL_BODY_ANSWER1 = "" CURRENT_MAIL_BODY_ANSWER1 = ""
CURRENT_MAIL_BODY_Substr2 = "" CURRENT_MAIL_BODY_Substr2 = ""
CURRENT_MAIL_MESSAGE = MyEmailMessage CURRENT_MAIL_MESSAGE = MyEmailMessage
CURRENT_MAIL_SUBJECT = MyEmailMessage.Subject.ToUpper CURRENT_MAIL_SUBJECT = MyEmailMessage.Subject.ToUpper.Replace("'", "''")
CURRENT_MAIL_MESSAGE_ID = RemoveIllegalFileNameChars(MyEmailMessage.MessageID) CURRENT_MAIL_MESSAGE_ID = RemoveIllegalFileNameChars(MyEmailMessage.MessageID)
CURRENT_MAIL_UID = poUID CURRENT_MAIL_UID = poUID
@ -184,7 +184,7 @@ Public Class clsWorkEmail
Dim oCreatedWho = "DDEmailProfiler" Dim oCreatedWho = "DDEmailProfiler"
Dim oMaskedBodyText = BodyText.Replace("'", "''") Dim oMaskedBodyText = BodyText.Replace("'", "''")
Dim oSubjectBodyText = String.Format(EmailStrings.EMAIL_SUBJECT_TEXT, CURRENT_MAIL_SUBJECT).Replace("'", "''") Dim oSubjectBodyText = String.Format(EmailStrings.EMAIL_SUBJECT_TEXT, CURRENT_MAIL_SUBJECT)
Dim oCompleteBodyText = oMaskedBodyText & oSubjectBodyText Dim oCompleteBodyText = oMaskedBodyText & oSubjectBodyText
Dim oFinalBodyText = String.Format(EmailStrings.EMAIL_WRAPPING_TEXT, oCompleteBodyText) Dim oFinalBodyText = String.Format(EmailStrings.EMAIL_WRAPPING_TEXT, oCompleteBodyText)
@ -814,8 +814,8 @@ Public Class clsWorkEmail
Logger.Error(ex) Logger.Error(ex)
Return False Return False
End Try End Try
End Function End Function
Private Function INSERT_HISTORY_ATTMT_MSSQL(oMSGID As String, ATTMT1 As String) Private Function INSERT_HISTORY_ATTMT_MSSQL(oMSGID As String, ATTMT1 As String)
If IsNothing(_DB_MSSQL) Then If IsNothing(_DB_MSSQL) Then
Logger.Info("INSERT_HISTORY_FB: _DB_MSSQL is nothing ") Logger.Info("INSERT_HISTORY_FB: _DB_MSSQL is nothing ")
@ -827,7 +827,7 @@ Public Class clsWorkEmail
$"('{CURRENT_MAIL_PROCESS_NAME}'," & $"('{CURRENT_MAIL_PROCESS_NAME}'," &
$"'{oMSGID}'," & $"'{oMSGID}'," &
$"'{CURRENT_MAIL_FROM}'," & $"'{CURRENT_MAIL_FROM}'," &
$"'{CURRENT_MAIL_MESSAGE.Subject.Replace("'", "''")}'," & $"'{CURRENT_MAIL_SUBJECT}'," &
$"'{CURRENT_MAIL_MESSAGE.Date}'," & $"'{CURRENT_MAIL_MESSAGE.Date}'," &
$"'{CURRENT_MAIL_BODY_ALL}'," & $"'{CURRENT_MAIL_BODY_ALL}'," &
$"'{ATTMT1}')" $"'{ATTMT1}')"