diff --git a/App/CONFIG_APP/App.config b/App/CONFIG_APP/App.config index dc8e265..34c16d8 100644 --- a/App/CONFIG_APP/App.config +++ b/App/CONFIG_APP/App.config @@ -1,18 +1,18 @@ - + -
+
-
+
- + - + @@ -20,13 +20,13 @@ Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd - + - + - + False @@ -36,10 +36,10 @@ - + - + sysdba @@ -58,9 +58,9 @@ - - + + - + \ No newline at end of file diff --git a/App/CONFIG_APP/My Project/AssemblyInfo.vb b/App/CONFIG_APP/My Project/AssemblyInfo.vb index 608cd1b..63e8664 100644 --- a/App/CONFIG_APP/My Project/AssemblyInfo.vb +++ b/App/CONFIG_APP/My Project/AssemblyInfo.vb @@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/App/CONFIG_APP/frmMain.vb b/App/CONFIG_APP/frmMain.vb index f6f448f..1cdca98 100644 --- a/App/CONFIG_APP/frmMain.vb +++ b/App/CONFIG_APP/frmMain.vb @@ -4,8 +4,6 @@ Imports System.Text.RegularExpressions Imports DigitalData.EMLProfiler Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Messaging -Imports Independentsoft.Email -Imports Independentsoft.Email.Mime Public Class frmMain Private Logger As DigitalData.Modules.Logging.Logger @@ -308,7 +306,6 @@ Public Class frmMain Try Dim oDiTempPath As New IO.DirectoryInfo(System.IO.Path.GetTempPath) Dim oaryFi As IO.FileInfo() = oDiTempPath.GetFiles() - Dim ofi As IO.FileInfo For Each fi In oaryFi fi.Delete() diff --git a/App/DigitalData.EMLProfiler/My Project/AssemblyInfo.vb b/App/DigitalData.EMLProfiler/My Project/AssemblyInfo.vb index 2795c94..fd2e536 100644 --- a/App/DigitalData.EMLProfiler/My Project/AssemblyInfo.vb +++ b/App/DigitalData.EMLProfiler/My Project/AssemblyInfo.vb @@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices - - + + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/App/DigitalData.EMLProfiler/app.config b/App/DigitalData.EMLProfiler/app.config index dc0bb7e..b4498a1 100644 --- a/App/DigitalData.EMLProfiler/app.config +++ b/App/DigitalData.EMLProfiler/app.config @@ -1,4 +1,4 @@ - + @@ -7,17 +7,17 @@ - + - + - + @@ -25,9 +25,9 @@ - - + + - + diff --git a/App/DigitalData.EMLProfiler/clsEmail.IMAP.vb b/App/DigitalData.EMLProfiler/clsEmail.IMAP.vb index 9299865..0c4dff8 100644 --- a/App/DigitalData.EMLProfiler/clsEmail.IMAP.vb +++ b/App/DigitalData.EMLProfiler/clsEmail.IMAP.vb @@ -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 diff --git a/App/DigitalData.EMLProfiler/clsWorkEmail.vb b/App/DigitalData.EMLProfiler/clsWorkEmail.vb index 529494c..890f19a 100644 --- a/App/DigitalData.EMLProfiler/clsWorkEmail.vb +++ b/App/DigitalData.EMLProfiler/clsWorkEmail.vb @@ -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}')" diff --git a/App/DigitalData.EMLProfiler/clsWorker.vb b/App/DigitalData.EMLProfiler/clsWorker.vb index e173184..543e183 100644 --- a/App/DigitalData.EMLProfiler/clsWorker.vb +++ b/App/DigitalData.EMLProfiler/clsWorker.vb @@ -1,5 +1,4 @@ Imports DigitalData.EMLProfiler.ClassCurrent -Imports Independentsoft.Email.Mime Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Messaging Imports Limilabs.Mail diff --git a/App/SERV_EMAIL/My Project/AssemblyInfo.vb b/App/SERV_EMAIL/My Project/AssemblyInfo.vb index f95bfef..fca7e2f 100644 --- a/App/SERV_EMAIL/My Project/AssemblyInfo.vb +++ b/App/SERV_EMAIL/My Project/AssemblyInfo.vb @@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/App/SERV_EMAIL/SERV_EMAIL.vbproj b/App/SERV_EMAIL/SERV_EMAIL.vbproj index 9f102b8..86f0b52 100644 --- a/App/SERV_EMAIL/SERV_EMAIL.vbproj +++ b/App/SERV_EMAIL/SERV_EMAIL.vbproj @@ -48,13 +48,11 @@ On - - False - ..\DigitalData.EMLProfiler\bin\Debug\DigitalData.EMLProfiler.dll + + ..\..\..\DDModules\Language\bin\Debug\DigitalData.Modules.Language.dll - - False - ..\..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll + + ..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll @@ -144,5 +142,11 @@ + + + {9f748dcd-952e-40a0-9dad-65bf8a39b231} + DigitalData.EMLProfiler + + \ No newline at end of file diff --git a/App/wisag_check_Att/App.config b/App/wisag_check_Att/App.config index f93bc8b..52a6b81 100644 --- a/App/wisag_check_Att/App.config +++ b/App/wisag_check_Att/App.config @@ -1,31 +1,31 @@ - + -
+
- + - + - + - + - - + +