MS Merge Commit
This commit is contained in:
@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("DigitalData.EMLProfiler")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2021")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("3.7.5.1")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("3.6.2.0")>
|
||||
<Assembly: AssemblyFileVersion("3.6.2.0")>
|
||||
<Assembly: AssemblyVersion("3.7.5.1")>
|
||||
<Assembly: AssemblyFileVersion("3.7.5.1")>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
@@ -7,17 +7,17 @@
|
||||
<!-- Dieser Abschnitt definiert die Protokollierungskonfiguration für My.Application.Log -->
|
||||
<source name="DefaultSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog"/>
|
||||
<add name="FileLog" />
|
||||
<!-- Auskommentierung des nachfolgenden Abschnitts aufheben, um in das Anwendungsereignisprotokoll zu schreiben -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information"/>
|
||||
<add name="DefaultSwitch" value="Information" />
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
|
||||
<!-- Auskommentierung des nachfolgenden Abschnitts aufheben und APPLICATION_NAME durch den Namen der Anwendung ersetzen, um in das Anwendungsereignisprotokoll zu schreiben -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
@@ -25,9 +25,9 @@
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
|
||||
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
</configuration>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
Imports Independentsoft.Email
|
||||
Imports Independentsoft.Email.Imap
|
||||
Imports Independentsoft.Email.Mime
|
||||
Imports DigitalData.EMLProfiler.ClassCurrent
|
||||
Imports DigitalData.EMLProfiler.ClassCurrent
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports AE
|
||||
Imports System.Net
|
||||
@@ -29,6 +26,7 @@ Public Class clsEmailIMAP
|
||||
oListuids = _limilab.IMAPGetMessageIDs_AllMails()
|
||||
|
||||
If IsNothing(oListuids) Then
|
||||
Logger.Warn("List of UIDs was Nothing. Returning False.")
|
||||
Return False
|
||||
Else
|
||||
If oListuids.Count > 0 Then
|
||||
@@ -38,8 +36,10 @@ Public Class clsEmailIMAP
|
||||
Else
|
||||
Logger.Debug("FetchIMAPMessagesLimilab - No Emails found!")
|
||||
End If
|
||||
|
||||
Return True
|
||||
End If
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
|
||||
@@ -4,6 +4,7 @@ Imports DigitalData.EMLProfiler.ClassCurrent
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports System.Threading
|
||||
Imports Limilabs.Mail
|
||||
Imports Limilabs.Mail.MIME
|
||||
@@ -13,6 +14,7 @@ Imports MailBox = Limilabs.Mail.Headers.MailBox
|
||||
|
||||
Public Class clsWorkEmail
|
||||
Private Const FILENAME_MAX_LENGTH = 100
|
||||
Private Const MESSAGE_ID_MAX_LENGTH = 100
|
||||
|
||||
Private Shared Logger As Logger
|
||||
Private MyLogger As LogConfig
|
||||
@@ -64,18 +66,43 @@ Public Class clsWorkEmail
|
||||
CURRENT_MAIL_BODY_ANSWER1 = ""
|
||||
CURRENT_MAIL_BODY_Substr2 = ""
|
||||
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_UID = poUID
|
||||
If IsNothing(CURRENT_MAIL_MESSAGE_ID) Then
|
||||
CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
|
||||
|
||||
|
||||
|
||||
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
|
||||
If CURRENT_MAIL_MESSAGE_ID.Length = 0 Then
|
||||
CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
|
||||
End If
|
||||
' 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
|
||||
@@ -89,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()
|
||||
@@ -135,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
|
||||
@@ -144,7 +184,7 @@ Public Class clsWorkEmail
|
||||
Dim oCreatedWho = "DDEmailProfiler"
|
||||
|
||||
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 oFinalBodyText = String.Format(EmailStrings.EMAIL_WRAPPING_TEXT, oCompleteBodyText)
|
||||
@@ -336,7 +376,7 @@ Public Class clsWorkEmail
|
||||
|
||||
' Subject can be FILENAME_MAX_LENGTH chars at most,
|
||||
' otherwise we run into errors with the path being too long
|
||||
Dim oSubjectFilename = CURRENT_MAIL_MESSAGE.Subject.Substring(0, FILENAME_MAX_LENGTH) & ".eml"
|
||||
Dim oSubjectFilename = CURRENT_MAIL_MESSAGE.Subject.Truncate(FILENAME_MAX_LENGTH) & ".eml"
|
||||
|
||||
Logger.Debug($"oSubjectFilename (beforeclean) is: {oSubjectFilename}")
|
||||
oSubjectFilename = RemoveIllegalFileNameChars(oSubjectFilename)
|
||||
@@ -399,7 +439,7 @@ Public Class clsWorkEmail
|
||||
|
||||
'oTempFilename &= "\" & CURRENT_MAIL_MESSAGE_ID & ".eml"
|
||||
Else
|
||||
Dim oFileName = CURRENT_MAIL_MESSAGE.Subject.Replace(" ", "") & ".eml"
|
||||
Dim oFileName = CURRENT_MAIL_MESSAGE.Subject.Truncate(FILENAME_MAX_LENGTH).Replace(" ", "") & ".eml"
|
||||
oTempFilename = Path.Combine(oTempFilename, oFileName)
|
||||
|
||||
'oTempFilename &= "\" & CURRENT_MAIL_MESSAGE.Subject.Replace(" ", "") & ".eml"
|
||||
@@ -737,7 +777,7 @@ Public Class clsWorkEmail
|
||||
If MessageError = False Then
|
||||
Dim ins = $"INSERT INTO TBEMLP_HISTORY (WORK_PROCESS,EMAIL_MSGID,EMAIL_SUBJECT,EMAIL_DATE,EMAIL_BODY,EMAIL_SUBSTRING1,EMAIL_SUBSTRING2,EMAIL_FROM,PROFILE_ID) VALUES " &
|
||||
$"('{CURRENT_MAIL_PROCESS_NAME}'," &
|
||||
$"'{CURRENT_MAIL_MESSAGE.MessageID.Replace("<", "").Replace(">", "")}'," &
|
||||
$"'{CURRENT_MAIL_MESSAGE_ID}'," &
|
||||
$"'{CURRENT_MAIL_SUBJECT}'," &
|
||||
$"'{CURRENT_MAIL_MESSAGE.Date}'," &
|
||||
$"'{CURRENT_MAIL_BODY_ALL}'," &
|
||||
@@ -774,8 +814,8 @@ Public Class clsWorkEmail
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function INSERT_HISTORY_ATTMT_MSSQL(oMSGID As String, ATTMT1 As String)
|
||||
If IsNothing(_DB_MSSQL) Then
|
||||
Logger.Info("INSERT_HISTORY_FB: _DB_MSSQL is nothing ")
|
||||
@@ -787,7 +827,7 @@ Public Class clsWorkEmail
|
||||
$"('{CURRENT_MAIL_PROCESS_NAME}'," &
|
||||
$"'{oMSGID}'," &
|
||||
$"'{CURRENT_MAIL_FROM}'," &
|
||||
$"'{CURRENT_MAIL_MESSAGE.Subject}'," &
|
||||
$"'{CURRENT_MAIL_SUBJECT}'," &
|
||||
$"'{CURRENT_MAIL_MESSAGE.Date}'," &
|
||||
$"'{CURRENT_MAIL_BODY_ALL}'," &
|
||||
$"'{ATTMT1}')"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
Imports DigitalData.EMLProfiler.ClassCurrent
|
||||
Imports Independentsoft.Email.Mime
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Messaging
|
||||
Imports Limilabs.Mail
|
||||
|
||||
Reference in New Issue
Block a user