fix messageid again
This commit is contained in:
parent
255e7e1a79
commit
7e88092ded
@ -69,20 +69,40 @@ Public Class clsWorkEmail
|
||||
CURRENT_MAIL_SUBJECT = MyEmailMessage.Subject.ToUpper
|
||||
CURRENT_MAIL_MESSAGE_ID = RemoveIllegalFileNameChars(MyEmailMessage.MessageID)
|
||||
CURRENT_MAIL_UID = poUID
|
||||
If IsNothing(CURRENT_MAIL_MESSAGE_ID) Then
|
||||
CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
|
||||
Else
|
||||
If CURRENT_MAIL_MESSAGE_ID.Length = 0 Then
|
||||
CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
|
||||
ElseIf CURRENT_MAIL_MESSAGE_ID.Length > MESSAGE_ID_MAX_LENGTH Then
|
||||
' MessageIds longer than 100 chars will be replaced with a guid to avoid errors
|
||||
' because of file paths longer than 255 chars.
|
||||
CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If String.IsNullOrEmpty(CURRENT_MAIL_MESSAGE_ID) Then
|
||||
|
||||
CURRENT_MAIL_MESSAGE_ID = Guid.NewGuid.ToString()
|
||||
|
||||
ElseIf CURRENT_MAIL_MESSAGE_ID.Length > MESSAGE_ID_MAX_LENGTH Then
|
||||
|
||||
' MessageIds longer than 100 chars will be replaced with a guid to avoid errors
|
||||
' because of file paths longer than 255 chars.
|
||||
CURRENT_MAIL_MESSAGE_ID = Hash(CURRENT_MAIL_MESSAGE_ID)
|
||||
|
||||
Else
|
||||
' Default case, should cover most message ids
|
||||
CURRENT_MAIL_MESSAGE_ID = CURRENT_MAIL_MESSAGE_ID.Replace(">", "").Replace("<", "")
|
||||
CURRENT_MAIL_MESSAGE_ID = CURRENT_MAIL_MESSAGE_ID.Replace("'", "")
|
||||
|
||||
End If
|
||||
CURRENT_MAIL_MESSAGE_ID = CURRENT_MAIL_MESSAGE_ID.Replace(">", "").Replace("<", "")
|
||||
CURRENT_MAIL_MESSAGE_ID = CURRENT_MAIL_MESSAGE_ID.Replace("'", "")
|
||||
|
||||
'If IsNothing(CURRENT_MAIL_MESSAGE_ID) Then
|
||||
' CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
|
||||
'Else
|
||||
' If CURRENT_MAIL_MESSAGE_ID.Length = 0 Then
|
||||
' CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
|
||||
' ElseIf CURRENT_MAIL_MESSAGE_ID.Length > MESSAGE_ID_MAX_LENGTH Then
|
||||
' ' MessageIds longer than 100 chars will be replaced with a guid to avoid errors
|
||||
' ' because of file paths longer than 255 chars.
|
||||
' CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
|
||||
|
||||
' End If
|
||||
'End If
|
||||
'CURRENT_MAIL_MESSAGE_ID = CURRENT_MAIL_MESSAGE_ID.Replace(">", "").Replace("<", "")
|
||||
'CURRENT_MAIL_MESSAGE_ID = CURRENT_MAIL_MESSAGE_ID.Replace("'", "")
|
||||
|
||||
|
||||
If IsNothing(CURRENT_MAIL_SUBJECT) Then
|
||||
@ -96,7 +116,7 @@ Public Class clsWorkEmail
|
||||
Dim osql = $"Select COALESCE(MAX(GUID),0) FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{CURRENT_MAIL_MESSAGE_ID}'"
|
||||
Dim oHistoryID = _DB_MSSQL.Execute_Scalar(osql)
|
||||
If oHistoryID > 0 Then
|
||||
Logger.Info($"Messsage with subject [{CURRENT_MAIL_SUBJECT}] from [{CURRENT_MAIL_FROM}] has already been worked!")
|
||||
Logger.Debug($"Messsage with subject [{CURRENT_MAIL_SUBJECT}] from [{CURRENT_MAIL_FROM}] has already been worked!")
|
||||
Return True
|
||||
End If
|
||||
Dim oTempMailExists As Boolean = SAVE2TEMP()
|
||||
@ -142,6 +162,19 @@ Public Class clsWorkEmail
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function Hash(pString As String) As String
|
||||
Using sha1 As Security.Cryptography.SHA1Managed = New Security.Cryptography.SHA1Managed()
|
||||
Dim oHash = sha1.ComputeHash(Text.Encoding.UTF8.GetBytes(pString))
|
||||
Dim oBuilder = New Text.StringBuilder(oHash.Length * 2)
|
||||
|
||||
For Each b As Byte In oHash
|
||||
oBuilder.Append(b.ToString("X2"))
|
||||
Next
|
||||
|
||||
Return oBuilder.ToString()
|
||||
End Using
|
||||
End Function
|
||||
|
||||
Public Function AddToEmailQueueMSSQL(MessageId As String, BodyText As String, SourceProcedure As String, pEmailAccountId As Integer) As Boolean
|
||||
|
||||
Try
|
||||
|
||||
@ -51,6 +51,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\DigitalData.EMLProfiler\bin\Debug\DigitalData.EMLProfiler.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Language, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\DDMonorepo\Modules.Language\bin\Debug\DigitalData.Modules.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=0.0.0.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user