Fix single quote in email subject
This commit is contained in:
@@ -11,6 +11,7 @@ Imports Limilabs.Mail.MIME
|
||||
Imports Limilabs.Mail.Headers
|
||||
Imports MailBox = Limilabs.Mail.Headers.MailBox
|
||||
Imports DigitalData.Modules.Patterns
|
||||
Imports System.Data.SqlClient
|
||||
|
||||
Public Class clsWorkEmail
|
||||
Private Const SUBJECT_MAX_LENGTH = 25
|
||||
@@ -714,7 +715,7 @@ Public Class clsWorkEmail
|
||||
If oFileLenth > 2 Then
|
||||
_Logger.Info(String.Format("Attachment saved to [{0}]", oAttachmentFilePath))
|
||||
'INSERT_HISTORY_FB(CURRENT_MAIL_MESSAGE_ID, oAttachment.SafeFileName)
|
||||
InsertAttachmentHistoryEntry(pCurrentMail, pCurrentMail.MessageId, oAttachment.SafeFileName, oAttachmentFileName)
|
||||
InsertAttachmentHistoryEntry(pCurrentMail, oAttachment.SafeFileName, oAttachmentFileName)
|
||||
oAttachmentCount += 1
|
||||
Else
|
||||
_Logger.Warn($"##!! oFileLenth for AttachmentObjects is <2 !!##")
|
||||
@@ -771,7 +772,8 @@ Public Class clsWorkEmail
|
||||
End Function
|
||||
|
||||
Private Function InsertHistoryEntryWithStatus(pCurrentMail As MailContainer, pStatus As String, pComment As String) As Boolean
|
||||
Dim ins = $"INSERT INTO TBEMLP_HISTORY (
|
||||
Dim oCommand = New SqlCommand(
|
||||
"INSERT INTO TBEMLP_HISTORY (
|
||||
WORK_PROCESS,
|
||||
EMAIL_MSGID,
|
||||
EMAIL_SUBJECT,
|
||||
@@ -782,31 +784,49 @@ Public Class clsWorkEmail
|
||||
EMAIL_FROM,
|
||||
PROFILE_ID,
|
||||
STATUS,
|
||||
COMMENT
|
||||
) VALUES (
|
||||
'{CurrentMailProcessName}',
|
||||
'{pCurrentMail.MessageId}',
|
||||
'{pCurrentMail.SubjectOriginal.EscapeForSQL()}',
|
||||
'{pCurrentMail.Mail.Date}',
|
||||
'{CURRENT_MAIL_BODY_ALL}',
|
||||
'{CURRENT_MAIL_BODY_ANSWER1}',
|
||||
'{CURRENT_MAIL_BODY_Substr2}',
|
||||
'{pCurrentMail.SenderAddress}',
|
||||
{CURRENT_PROFILE_GUID},
|
||||
'{pStatus}',
|
||||
'{pComment.Truncate(500)}'
|
||||
)"
|
||||
Return _DB_MSSQL.ExecuteNonQuery(ins)
|
||||
COMMENT)
|
||||
VALUES (
|
||||
@WORK_PROCESS,
|
||||
@MESSAGE_ID,
|
||||
@SUBJECT,
|
||||
@DATE,
|
||||
@BODY,
|
||||
@SUBSTRING1,
|
||||
@SUBSTRING2,
|
||||
@FROM,
|
||||
@PROFILE_ID,
|
||||
@STATUS,
|
||||
@COMMENT)"
|
||||
)
|
||||
|
||||
oCommand.Parameters.Add("WORK_PROCESS", SqlDbType.VarChar, 100).Value = CurrentMailProcessName
|
||||
oCommand.Parameters.Add("MESSAGE_ID", SqlDbType.VarChar, 500).Value = pCurrentMail.MessageId
|
||||
oCommand.Parameters.Add("SUBJECT", SqlDbType.VarChar, 1000).Value = pCurrentMail.SubjectOriginal
|
||||
oCommand.Parameters.Add("DATE", SqlDbType.DateTime).Value = pCurrentMail.Mail.Date
|
||||
oCommand.Parameters.Add("BODY", SqlDbType.VarChar).Value = CURRENT_MAIL_BODY_ALL
|
||||
oCommand.Parameters.Add("SUBSTRING1", SqlDbType.VarChar, 2000).Value = CURRENT_MAIL_BODY_ANSWER1
|
||||
oCommand.Parameters.Add("SUBSTRING2", SqlDbType.VarChar, 2000).Value = CURRENT_MAIL_BODY_Substr2
|
||||
oCommand.Parameters.Add("FROM", SqlDbType.VarChar, 500).Value = pCurrentMail.SenderAddress
|
||||
oCommand.Parameters.Add("PROFILE_ID", SqlDbType.Int).Value = CURRENT_PROFILE_GUID
|
||||
oCommand.Parameters.Add("STATUS", SqlDbType.VarChar, 900).Value = pStatus
|
||||
oCommand.Parameters.Add("COMMENT", SqlDbType.VarChar, 500).Value = pComment.Truncate(500)
|
||||
|
||||
Return _DB_MSSQL.ExecuteNonQuery(oCommand)
|
||||
End Function
|
||||
|
||||
Private Function InsertAttachmentHistoryEntry(pCurrentMail As MailContainer, pMessageId As String, pFileName As String, pNewFileName As String) As Boolean
|
||||
Private Function InsertAttachmentHistoryEntry(pCurrentMail As MailContainer, pFileName As String, pNewFileName As String) As Boolean
|
||||
If IsNothing(_DB_MSSQL) Then
|
||||
_Logger.Info("INSERT_HISTORY_FB: _DB_MSSQL is nothing ")
|
||||
Return False
|
||||
End If
|
||||
Try
|
||||
If MESSAGE_ERROR = False Then
|
||||
Dim ins = $"INSERT INTO TBEMLP_HISTORY_ATTACHMENT (
|
||||
If MESSAGE_ERROR = True Then
|
||||
_Logger.Warn("MESSAGE_ERROR = true, not inserting!")
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oCommand = New SqlCommand(
|
||||
"INSERT INTO TBEMLP_HISTORY_ATTACHMENT (
|
||||
WORK_PROCESS,
|
||||
EMAIL_MSGID,
|
||||
EMAIL_FROM,
|
||||
@@ -815,17 +835,27 @@ Public Class clsWorkEmail
|
||||
EMAIL_BODY,
|
||||
EMAIL_ATTMT,
|
||||
EMAIL_ATTMT_INDEX
|
||||
) VALUES " &
|
||||
$"('{CurrentMailProcessName}'," &
|
||||
$"'{pMessageId}'," &
|
||||
$"'{pCurrentMail.SenderAddress}'," &
|
||||
$"'{pCurrentMail.SubjectOriginal}'," &
|
||||
$"'{pCurrentMail.Mail.Date}'," &
|
||||
$"'{CURRENT_MAIL_BODY_ALL}'," &
|
||||
$"'{pFileName}'," &
|
||||
$"'{pNewFileName}')"
|
||||
_DB_MSSQL.ExecuteNonQuery(ins)
|
||||
End If
|
||||
) VALUES (
|
||||
@WORK_PROCESS,
|
||||
@MESSAGE_ID,
|
||||
@FROM,
|
||||
@SUBJECT,
|
||||
@DATE,
|
||||
@BODY,
|
||||
@ATTACHMENT,
|
||||
@ATTACHMENT_INDEX
|
||||
)")
|
||||
|
||||
oCommand.Parameters.Add("WORK_PROCESS", SqlDbType.VarChar, 100).Value = CurrentMailProcessName
|
||||
oCommand.Parameters.Add("MESSAGE_ID", SqlDbType.VarChar, 500).Value = pCurrentMail.MessageId
|
||||
oCommand.Parameters.Add("SUBJECT", SqlDbType.VarChar, 1000).Value = pCurrentMail.SubjectOriginal
|
||||
oCommand.Parameters.Add("DATE", SqlDbType.DateTime).Value = pCurrentMail.Mail.Date
|
||||
oCommand.Parameters.Add("BODY", SqlDbType.VarChar).Value = CURRENT_MAIL_BODY_ALL
|
||||
oCommand.Parameters.Add("FROM", SqlDbType.VarChar, 500).Value = pCurrentMail.SenderAddress
|
||||
oCommand.Parameters.Add("ATTACHMENT", SqlDbType.VarChar, 500).Value = pFileName
|
||||
oCommand.Parameters.Add("ATTACHMENT_INDEX", SqlDbType.VarChar, 500).Value = pNewFileName
|
||||
|
||||
_DB_MSSQL.ExecuteNonQuery(oCommand)
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
|
||||
Reference in New Issue
Block a user