MS Release CleanFileName

This commit is contained in:
SchreiberM 2021-12-01 12:12:04 +01:00
parent ae5bc40f5f
commit 0f94cab4f1
88 changed files with 329 additions and 9548 deletions

Binary file not shown.

View File

@ -64,17 +64,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DDMonorepo\Modules.Messaging\bin\Debug\DigitalData.Modules.Messaging.dll</HintPath>
</Reference>
<Reference Include="Independentsoft.Email, Version=2.1.5953.24395, Culture=neutral, PublicKeyToken=76be97fe952f1ec7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Email .NET\Bin\Independentsoft.Email.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="S22.Imap, Version=3.6.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\S22.Imap.3.6.0.0\lib\net40\S22.Imap.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.5.0.0")>
<Assembly: AssemblyVersion("2.7.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -22,31 +22,6 @@ DigitalData.Modules.Messaging
Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
</summary>
</member>
<member name="M:DigitalData.Modules.Messaging.Email.TestIMAPLogin(System.String,System.Int32,System.String,System.String,System.String)">
<summary>
Tests connection to a given IMAP Server by connecting and doing a simple message query.
</summary>
<param name="Server">IP-Address or Domainname of Server</param>
<param name="Port">IMAP-Port</param>
<param name="Username">IMAP-Username</param>
<param name="Password">IMAP-Password</param>
<param name="Folder">The folder to fetch messages from. Defaults to `Inbox`</param>
<returns>True if connection and query were successful. False otherwise.</returns>
</member>
<member name="M:DigitalData.Modules.Messaging.Email.FetchIMAPMessages(System.String,System.Int32,System.String,System.String,System.String)">
<summary>
Connects to an IMAP Server with the given credentials and
fetches emails from the given folder.
Results can be filtered with `SearchCondition`
</summary>
<param name="Server">IP-Address or Domainname of Server</param>
<param name="Port">IMAP-Port</param>
<param name="Username">IMAP-Username</param>
<param name="Password">IMAP-Password</param>
<param name="Folder">The folder to fetch messages from</param>
<param name="SearchCondition">Filter the search command. Defaults to `All`</param>
<returns>A list of Independentsoft.Email.Mime.Message objects</returns>
</member>
<member name="M:DigitalData.Modules.Messaging.Email.WriteMessageToFile(System.Net.Mail.MailMessage,System.String)">
<summary>
Uses a private API from MailWriter to write a MailMessage to disk.
@ -80,7 +55,7 @@ DigitalData.Modules.Messaging
<param name="pSuffix">The optional suffix to add to the original filename.</param>
<returns>The path of the new EML without attachments.</returns>
</member>
<member name="M:DigitalData.Modules.Messaging.Limilab.InitIMAP(System.String,System.Int32,System.String,System.String,System.String,System.String)">
<member name="M:DigitalData.Modules.Messaging.Limilab.InitIMAP(System.Boolean,System.String,System.Int32,System.String,System.String,System.String,System.String)">
<summary>
Initializes the module.
</summary>
@ -97,7 +72,7 @@ DigitalData.Modules.Messaging
</summary>
<returns>True if connection and query were successful. False otherwise.</returns>
</member>
<member name="M:DigitalData.Modules.Messaging.Limilab.NewSMTPEmail(System.String,System.String,System.String,System.String,System.String,System.Int32,System.String,System.String,System.String,System.String,System.String,System.Boolean)">
<member name="M:DigitalData.Modules.Messaging.Limilab.NewSMTPEmail(System.String,System.String,System.String,System.String,System.String,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.Boolean)">
<summary>
Creates a MailObject and sends Mail via smtp.
</summary>

File diff suppressed because it is too large Load Diff

View File

@ -283,6 +283,7 @@ Partial Class frmMain
Me.ToolStripSeparator12 = New System.Windows.Forms.ToolStripSeparator()
Me.ToolStripButton34 = New System.Windows.Forms.ToolStripButton()
Me.TabPage3 = New System.Windows.Forms.TabPage()
Me.btnCheckIMAPObjects = New System.Windows.Forms.Button()
Me.AUTH_TYPEComboBox = New System.Windows.Forms.ComboBox()
Me.btntestImap = New System.Windows.Forms.Button()
Me.ARCHIVE_FOLDERTextBox = New System.Windows.Forms.TextBox()
@ -1678,7 +1679,7 @@ Partial Class frmMain
Me.BindingNavigator2.MovePreviousItem = Me.ToolStripButton5
Me.BindingNavigator2.Name = "BindingNavigator2"
Me.BindingNavigator2.PositionItem = Me.ToolStripTextBox1
Me.BindingNavigator2.Size = New System.Drawing.Size(968, 25)
Me.BindingNavigator2.Size = New System.Drawing.Size(1177, 25)
Me.BindingNavigator2.TabIndex = 32
Me.BindingNavigator2.Text = "BindingNavigator2"
'
@ -1793,7 +1794,7 @@ Partial Class frmMain
Me.GridControl1.Location = New System.Drawing.Point(0, 0)
Me.GridControl1.MainView = Me.GridView1
Me.GridControl1.Name = "GridControl1"
Me.GridControl1.Size = New System.Drawing.Size(241, 331)
Me.GridControl1.Size = New System.Drawing.Size(241, 314)
Me.GridControl1.TabIndex = 0
Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
'
@ -2945,6 +2946,7 @@ Partial Class frmMain
'TabPage3
'
Me.TabPage3.AutoScroll = True
Me.TabPage3.Controls.Add(Me.btnCheckIMAPObjects)
Me.TabPage3.Controls.Add(AUTH_TYPELabel)
Me.TabPage3.Controls.Add(Me.AUTH_TYPEComboBox)
Me.TabPage3.Controls.Add(Me.btntestImap)
@ -2990,6 +2992,19 @@ Partial Class frmMain
Me.TabPage3.Text = "EMail-Konto Konfiguration"
Me.TabPage3.UseVisualStyleBackColor = True
'
'btnCheckIMAPObjects
'
Me.btnCheckIMAPObjects.Image = Global.CONFIG_APP.My.Resources.Resources.arrow_right
Me.btnCheckIMAPObjects.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnCheckIMAPObjects.Location = New System.Drawing.Point(831, 203)
Me.btnCheckIMAPObjects.Name = "btnCheckIMAPObjects"
Me.btnCheckIMAPObjects.Size = New System.Drawing.Size(189, 35)
Me.btnCheckIMAPObjects.TabIndex = 80
Me.btnCheckIMAPObjects.Text = "Check Unseen IMAP Objects"
Me.btnCheckIMAPObjects.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnCheckIMAPObjects.UseVisualStyleBackColor = True
Me.btnCheckIMAPObjects.Visible = False
'
'AUTH_TYPEComboBox
'
Me.AUTH_TYPEComboBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_EMAIL_ACCOUNTBindingSource, "AUTH_TYPE", True))
@ -3892,4 +3907,5 @@ Partial Class frmMain
Friend WithEvents ToolStripLabel5 As ToolStripLabel
Friend WithEvents ToolStripEmailAccountID As ToolStripTextBox
Friend WithEvents AUTH_TYPEComboBox As ComboBox
Friend WithEvents btnCheckIMAPObjects As Button
End Class

View File

@ -403,9 +403,6 @@
rkJggg==
</value>
</data>
<metadata name="TBEMLP_POLL_PROCESSBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
</metadata>
<data name="ToolStripButton3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
@ -458,27 +455,6 @@
8l/FYwIYQ4UGBWBgAAC+0b+zuQxOnAAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="BindingNavigator3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1021, 95</value>
</metadata>
<metadata name="BindingNavigator4.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1175, 95</value>
</metadata>
<metadata name="BindingNavigator5.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1143, 134</value>
</metadata>
<metadata name="BindingNavigator6.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>851, 173</value>
</metadata>
<metadata name="MyDataset.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>180, 56</value>
</metadata>
<metadata name="TBDD_EMAIL_ACCOUNTBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>623, 134</value>
</metadata>
<metadata name="TBEMLP_POLL_STEPSBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>537, 95</value>
</metadata>
<metadata name="TBEMLP_POLL_STEPSBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>537, 95</value>
</metadata>
@ -552,9 +528,6 @@
<metadata name="TBEMLP_POLL_INDEXING_STEPSBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 134</value>
</metadata>
<metadata name="TBEMLP_POLL_INDEXING_STEPSBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 134</value>
</metadata>
<metadata name="BindingNavigator4.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1175, 95</value>
</metadata>
@ -625,9 +598,6 @@
<metadata name="TBEMLP_CONFIGBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>239, 173</value>
</metadata>
<metadata name="TBEMLP_CONFIGBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>239, 173</value>
</metadata>
<metadata name="TBEMLP_HISTORYBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1297, 134</value>
</metadata>

View File

@ -289,13 +289,13 @@ Public Class frmMain
MyLogger.Debug = True
Dim _work As New clsWorker(MyLogger, _SQLServerConString, GUIDTextBox.Text, My.Settings.FB_DATASOURCE, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW,
My.Settings.USE_WM, ToolStripEmailAccountID.Text)
My.Settings.USE_WM, ToolStripEmailAccountID.Text, "EmailProfilerTestClient")
_work.Start_WorkingProfiles()
Else
For Each ofile As String In _Worklist
Logger.Info($"## Manual working on file {ofile} ... ")
Dim _work As New clsWorker(MyLogger, _SQLServerConString, GUIDTextBox.Text, My.Settings.FB_DATASOURCE, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW, My.Settings.USE_WM, ofile)
Dim _work As New clsWorker(MyLogger, _SQLServerConString, GUIDTextBox.Text, My.Settings.FB_DATASOURCE, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW, My.Settings.USE_WM, ToolStripEmailAccountID.Text, "EmailProfilerTestClient", ofile)
_work.Start_WorkingProfiles(True)
Next
@ -678,17 +678,17 @@ Public Class frmMain
_database.Execute_non_Query(upd)
Load_Config()
End Sub
Private Function GetChildren(ByVal bodyParts As BodyPartCollection) As BodyPartCollection
'Private Function GetChildren(ByVal bodyParts As BodyPartCollection) As BodyPartCollection
Dim children As New BodyPartCollection()
' Dim children As New BodyPartCollection()
For i As Integer = 0 To bodyParts.Count - 1
children.Add(GetChildren(bodyParts(i).BodyParts))
children.Add(bodyParts(i))
Next
' For i As Integer = 0 To bodyParts.Count - 1
' children.Add(GetChildren(bodyParts(i).BodyParts))
' children.Add(bodyParts(i))
' Next
Return children
End Function
' Return children
'End Function
Private Sub STEP_NAMEComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles STEP_NAMEComboBox.SelectedIndexChanged
Label9.Visible = False
@ -744,24 +744,35 @@ Public Class frmMain
Dim oSQL = $"SELECT * FROM TBDD_EMAIL_ACCOUNT WHERE GUID = {EMAILIDTextBox.Text}"
Dim oDT As DataTable = _database.Return_Datatable(oSQL)
If Not IsNothing(oDT) Then
If oDT.Rows.Count = 1 Then
Dim PWPlain = _Encryption.DecryptData(oDT.Rows(0).Item("EMAIL_PW"))
'Logger.Debug($"PWis !{PWPlain}35452dd=")
_limilab.InitIMAP(oDT.Rows(0).Item("EMAIL_SMTP"), oDT.Rows(0).Item("PORT_IN"), oDT.Rows(0).Item("EMAIL_USER"), PWPlain, oDT.Rows(0).Item("AUTH_TYPE"))
_limilab.InitIMAP(True, oDT.Rows(0).Item("EMAIL_SMTP"), oDT.Rows(0).Item("PORT_IN"), oDT.Rows(0).Item("EMAIL_USER"), PWPlain, oDT.Rows(0).Item("AUTH_TYPE"))
Dim oResult = _limilab.IMAPTestLogin()
If oResult = False Then
MsgBox("Access Imap NOT successfull", MsgBoxStyle.Critical)
Else
MsgBox("Test Successful!", MsgBoxStyle.Information)
MsgBox("IMAP-Test Successful!", MsgBoxStyle.Information)
btnCheckIMAPObjects.Visible = True
End If
End If
End If
End Sub
Private Sub btnCheckIMAPObjects_Click(sender As Object, e As EventArgs) Handles btnCheckIMAPObjects.Click
Dim oListuids As New List(Of Long)
oListuids = _limilab.IMAPGetUnseenMessageIDs()
If IsNothing(oListuids) Then
MsgBox("Something went wrong! - Check Your log.", MsgBoxStyle.Critical)
Else
_limilab.CloseImap()
MsgBox($"IMAP-Folder contained [{oListuids.Count}] unseen Objects!", MsgBoxStyle.Information)
End If
End Sub
Private Sub btnTestRegEx_Click(sender As Object, e As EventArgs) Handles btnTestRegEx.Click
txtResultRegEx.Text = ""
Try
@ -815,56 +826,56 @@ Public Class frmMain
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Try
txthtmlEmail.Text = ""
txthtmlEmail.BackColor = Color.Wheat
Dim oOpenFileDialog1 As New OpenFileDialog()
'Try
' txthtmlEmail.Text = ""
' txthtmlEmail.BackColor = Color.Wheat
' Dim oOpenFileDialog1 As New OpenFileDialog()
' openFileDialog1.InitialDirectory = "c:\"
oOpenFileDialog1.Filter = "Emails (*.eml)|*.eml|All files (*.*)|*.*"
oOpenFileDialog1.FilterIndex = 2
oOpenFileDialog1.RestoreDirectory = True
' ' openFileDialog1.InitialDirectory = "c:\"
' oOpenFileDialog1.Filter = "Emails (*.eml)|*.eml|All files (*.*)|*.*"
' oOpenFileDialog1.FilterIndex = 2
' oOpenFileDialog1.RestoreDirectory = True
If oOpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Dim oMsg_email As New Independentsoft.Email.Mime.Message(oOpenFileDialog1.FileName)
Dim oBodyText As String = ""
If IsNothing(oMsg_email.Body) Then
Dim oAllBodyParts As New BodyPartCollection()
oAllBodyParts.Add(oMsg_email.BodyParts)
oAllBodyParts.Add(GetChildren(oMsg_email.BodyParts))
For Each bodyPart As BodyPart In oAllBodyParts
If bodyPart.ContentType IsNot Nothing AndAlso bodyPart.ContentType.Type = "text" AndAlso bodyPart.ContentType.SubType = "plain" Then
If oBodyText = String.Empty Then
Logger.Debug(String.Format("BODY1-Text is....#{0}", bodyPart.Body))
oBodyText = bodyPart.Body
Else
Continue For
End If
ElseIf bodyPart.ContentType IsNot Nothing AndAlso bodyPart.ContentType.Type = "text" AndAlso bodyPart.ContentType.SubType = "html" Then
If oBodyText = String.Empty Then
oBodyText = bodyPart.Body
Logger.Debug(String.Format("bodyhtml....#{0}", bodyPart.Body))
Else
Continue For
End If
Logger.Debug(String.Format("bodyhtml....#{0}", bodyPart.Body))
End If
Next
If oBodyText = "" Then
MsgBox("No html-body extractable?!")
Else
txthtmlEmail.Text = oBodyText
txthtmlEmail.BackColor = Color.Yellow
End If
Else
txthtmlEmail.Text = oMsg_email.Body
txthtmlEmail.BackColor = Color.Yellow
End If
' If oOpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
' Dim oMsg_email As New Independentsoft.Email.Mime.Message(oOpenFileDialog1.FileName)
' Dim oBodyText As String = ""
' If IsNothing(oMsg_email.Body) Then
' Dim oAllBodyParts As New BodyPartCollection()
' oAllBodyParts.Add(oMsg_email.BodyParts)
' oAllBodyParts.Add(GetChildren(oMsg_email.BodyParts))
' For Each bodyPart As BodyPart In oAllBodyParts
' If bodyPart.ContentType IsNot Nothing AndAlso bodyPart.ContentType.Type = "text" AndAlso bodyPart.ContentType.SubType = "plain" Then
' If oBodyText = String.Empty Then
' Logger.Debug(String.Format("BODY1-Text is....#{0}", bodyPart.Body))
' oBodyText = bodyPart.Body
' Else
' Continue For
' End If
' ElseIf bodyPart.ContentType IsNot Nothing AndAlso bodyPart.ContentType.Type = "text" AndAlso bodyPart.ContentType.SubType = "html" Then
' If oBodyText = String.Empty Then
' oBodyText = bodyPart.Body
' Logger.Debug(String.Format("bodyhtml....#{0}", bodyPart.Body))
' Else
' Continue For
' End If
' Logger.Debug(String.Format("bodyhtml....#{0}", bodyPart.Body))
' End If
' Next
' If oBodyText = "" Then
' MsgBox("No html-body extractable?!")
' Else
' txthtmlEmail.Text = oBodyText
' txthtmlEmail.BackColor = Color.Yellow
' End If
' Else
' txthtmlEmail.Text = oMsg_email.Body
' txthtmlEmail.BackColor = Color.Yellow
' End If
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
' End If
'Catch ex As Exception
' MsgBox(ex.Message, MsgBoxStyle.Critical)
'End Try
End Sub
@ -897,8 +908,13 @@ Public Class frmMain
Private Sub COMMENTTextBox_Leave(sender As Object, e As EventArgs) Handles COMMENTTextBox.Leave
Try
Dim separatorIndex = COMMENTTextBox.Text.IndexOf(".")
TextBox1.Text = COMMENTTextBox.Text.Substring(separatorIndex, COMMENTTextBox.Text.Length - 1)
Catch ex As Exception
End Try
End Sub
Private Sub EMAILIDTextBox_TextChanged(sender As Object, e As EventArgs) Handles EMAILIDTextBox.TextChanged
@ -907,7 +923,7 @@ Public Class frmMain
Else
ToolStripEmailAccountID.Text = "Choose Email-Config"
End If
btnCheckIMAPObjects.Visible = False
End Sub
Private Sub AUTH_TYPEComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles AUTH_TYPEComboBox.SelectedIndexChanged
@ -920,4 +936,15 @@ Public Class frmMain
End Select
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Try
If ComboBox1.SelectedIndex <> -1 Then
ToolStripEmailAccountID.Text = ComboBox1.SelectedValue
End If
Catch ex As Exception
End Try
End Sub
End Class

View File

@ -1 +1 @@
95daf7e3d3207550e7dac80df1cfd1d9d80b6a25
731743bc36952eeddee9457809a0beb5ae6eac4a

View File

@ -1,11 +1,10 @@
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Oracle.ManagedDataAccess.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\obj\Debug\CONFIG_APP.exe
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Printing.v19.2.Core.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Printing.v19.2.Core.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\CONFIG_APP.exe.config
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\CONFIG_APP.exe
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\CONFIG_APP.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\CONFIG_APP.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Data.v19.2.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Printing.v19.2.Core.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Utils.v19.2.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.XtraEditors.v19.2.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.XtraGrid.v19.2.dll
@ -14,12 +13,9 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExp
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.EMLProfiler.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Logging.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Messaging.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Independentsoft.Email.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\NLog.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\S22.Imap.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Mail.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Interop.WINDREAMLib.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Independentsoft.Msg.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Database.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Pdf.v19.2.Core.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Sparkline.v19.2.Core.dll
@ -29,6 +25,7 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExp
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Filesystem.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Language.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\FirebirdSql.Data.FirebirdClient.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Oracle.ManagedDataAccess.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Encryption.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Office.v19.2.Core.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Images.v19.2.dll
@ -37,7 +34,6 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Digita
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.EMLProfiler.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.EMLProfiler.dll.config
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Data.v19.2.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Printing.v19.2.Core.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.Utils.v19.2.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.XtraEditors.v19.2.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DevExpress.XtraGrid.v19.2.xml
@ -47,10 +43,7 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Digita
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Logging.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Messaging.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Messaging.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Independentsoft.Email.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\NLog.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\S22.Imap.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\Independentsoft.Msg.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Database.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Database.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\bin\Debug\DigitalData.Modules.Database.dll.config
@ -126,5 +119,6 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\obj\Debug\CONFIG
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\obj\Debug\CONFIG_APP.exe.licenses
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\obj\Debug\CONFIG_APP.vbproj.CoreCompileInputs.cache
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\obj\Debug\CONFIG_APP.vbproj.CopyComplete
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\obj\Debug\CONFIG_APP.exe
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\obj\Debug\CONFIG_APP.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\CONFIG_APP\obj\Debug\CONFIG_APP.pdb

View File

@ -3,6 +3,8 @@ Imports Limilabs.Mail
Imports Limilabs.Mail.MIME
Imports Limilabs.Mail.Headers
Imports MailBox = Limilabs.Mail.Headers.MailBox
Imports Limilabs.Client.IMAP
Public Class ClassCurrent
Public Shared WM_CON_STRING As String
Public Shared WM_DRIVE As String
@ -27,11 +29,13 @@ Public Class ClassCurrent
Public Shared MAIL_PORT As Integer = 995
Public Shared MAIL_INBOX_NAME As String = "Inbox"
Public Shared MAIL_ARCHIVE_FOLDER As String = ""
Public Shared MAIL_AUTHTYPE As String
Public Shared DT_POLL_PROCESS As DataTable
Public Shared DT_STEPS As DataTable
Public Shared DT_INDEXING_STEPS As DataTable
Public Shared CURRENT_WORKMAIL_LIST As New ArrayList()
' Public Shared oCURRENT_WORKMAIL_LIST As New ArrayList()
Public Shared CURRENT_WORKMAIL_UID_LIST As New List(Of Long)
Public Shared CURRENT_MAIL_MESSAGE As IMail
Public Shared CURRENT_TEMP_MAIL_PATH As String
@ -41,8 +45,11 @@ Public Class ClassCurrent
Public Shared CURRENT_MAIL_SUBJECT As String = ""
Public Shared CURRENT_MAIL_FROM As String = ""
Public Shared CURRENT_MAIL_MESSAGE_ID As String = ""
Public Shared CURRENT_MAIL_UID As Long
Public Shared CURRENT_MAIL_PROCESS_NAME As String
Public Shared CURRENT_ImapObject As Imap
Public Shared DeleteMail As Boolean = False
Public Shared CURRENT_POLL_TYPE As String
Public Shared POLL_STEP_GUID As Integer

View File

@ -59,9 +59,6 @@
<Reference Include="DigitalData.Modules.Messaging">
<HintPath>..\..\..\DDMonorepo\Modules.Messaging\bin\Debug\DigitalData.Modules.Messaging.dll</HintPath>
</Reference>
<Reference Include="Independentsoft.Msg">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\Independentsoft.Msg.dll</HintPath>
</Reference>
<Reference Include="Interop.WINDREAMLib">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
@ -82,9 +79,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\NLog.dll</HintPath>
</Reference>
<Reference Include="S22.Imap, Version=3.6.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\S22.Imap.3.6.0.0\lib\net40\S22.Imap.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />

View File

@ -3,4 +3,5 @@
Public CURRENToWMSession_Created As Date = Now
Public CURRENToWMConnect As Object
Public CURRENT_ATTMT_COUNT As Integer
Public SUBJECT_PRAFIX As String = "EmailProfiler"
End Module

View File

@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("DigitalData.EMLProfiler")>
<Assembly: AssemblyCopyright("Copyright © 2018")>
<Assembly: AssemblyCopyright("Copyright © 2021")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.5.0.0")>
<Assembly: AssemblyFileVersion("3.5.0.0")>
<Assembly: AssemblyVersion("3.6.2.0")>
<Assembly: AssemblyFileVersion("3.6.2.0")>

View File

@ -53,15 +53,6 @@ Namespace My
Return defaultInstance
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("Email-Profiler")> _
Public ReadOnly Property PraefixSubject() As String
Get
Return CType(Me("PraefixSubject"),String)
End Get
End Property
End Class
End Namespace

View File

@ -1,9 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles />
<Settings>
<Setting Name="PraefixSubject" Type="System.String" Scope="Application">
<Value Profile="(Default)">Email-Profiler</Value>
</Setting>
</Settings>
<Settings />
</SettingsFile>

View File

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DigitalData.EMLProfiler.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.diagnostics>
<sources>
@ -27,11 +24,4 @@
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<applicationSettings>
<DigitalData.EMLProfiler.My.MySettings>
<setting name="PraefixSubject" serializeAs="String">
<value>Email-Profiler</value>
</setting>
</DigitalData.EMLProfiler.My.MySettings>
</applicationSettings>
</configuration>

View File

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DigitalData.EMLProfiler.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.diagnostics>
<sources>
@ -27,11 +24,4 @@
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<applicationSettings>
<DigitalData.EMLProfiler.My.MySettings>
<setting name="PraefixSubject" serializeAs="String">
<value>Email-Profiler</value>
</setting>
</DigitalData.EMLProfiler.My.MySettings>
</applicationSettings>
</configuration>

View File

@ -22,31 +22,6 @@ DigitalData.Modules.Messaging
Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
</summary>
</member>
<member name="M:DigitalData.Modules.Messaging.Email.TestIMAPLogin(System.String,System.Int32,System.String,System.String,System.String)">
<summary>
Tests connection to a given IMAP Server by connecting and doing a simple message query.
</summary>
<param name="Server">IP-Address or Domainname of Server</param>
<param name="Port">IMAP-Port</param>
<param name="Username">IMAP-Username</param>
<param name="Password">IMAP-Password</param>
<param name="Folder">The folder to fetch messages from. Defaults to `Inbox`</param>
<returns>True if connection and query were successful. False otherwise.</returns>
</member>
<member name="M:DigitalData.Modules.Messaging.Email.FetchIMAPMessages(System.String,System.Int32,System.String,System.String,System.String)">
<summary>
Connects to an IMAP Server with the given credentials and
fetches emails from the given folder.
Results can be filtered with `SearchCondition`
</summary>
<param name="Server">IP-Address or Domainname of Server</param>
<param name="Port">IMAP-Port</param>
<param name="Username">IMAP-Username</param>
<param name="Password">IMAP-Password</param>
<param name="Folder">The folder to fetch messages from</param>
<param name="SearchCondition">Filter the search command. Defaults to `All`</param>
<returns>A list of Independentsoft.Email.Mime.Message objects</returns>
</member>
<member name="M:DigitalData.Modules.Messaging.Email.WriteMessageToFile(System.Net.Mail.MailMessage,System.String)">
<summary>
Uses a private API from MailWriter to write a MailMessage to disk.
@ -80,7 +55,7 @@ DigitalData.Modules.Messaging
<param name="pSuffix">The optional suffix to add to the original filename.</param>
<returns>The path of the new EML without attachments.</returns>
</member>
<member name="M:DigitalData.Modules.Messaging.Limilab.InitIMAP(System.String,System.Int32,System.String,System.String,System.String,System.String)">
<member name="M:DigitalData.Modules.Messaging.Limilab.InitIMAP(System.Boolean,System.String,System.Int32,System.String,System.String,System.String,System.String)">
<summary>
Initializes the module.
</summary>

File diff suppressed because it is too large Load Diff

View File

@ -8,155 +8,46 @@ Imports System.Net
Imports System.Reflection
Imports System.IO
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Messaging
Public Class clsEmailIMAP
Private Shared Logger As DigitalData.Modules.Logging.Logger
Private Shared LogConfig As DigitalData.Modules.Logging.LogConfig
Private _DB_MSSQL As clsDatabase
Private _limilab As DigitalData.Modules.Messaging.Limilab
Sub New(LogConf As LogConfig, ECMConnectionString As String)
LogConfig = LogConf
Logger = LogConf.GetLogger
_DB_MSSQL = New clsDatabase(LogConf, ECMConnectionString)
_limilab = New Limilab(LogConf)
End Sub
'Private Shared Sub OnWriteLog(ByVal sender As Object, ByVal e As WriteLogEventArgs)
' Logger.Info(e.Log)
'End Sub
Public Function FetchIMAPMessagesS22(Server As String, Port As Integer, Username As String, Password As String, pInbox As String, Optional IsTest As Boolean = False, Optional DeleteinTest As Boolean = False, Optional MoveMailTo As String = "") As Boolean
Logger.Debug("FetchIMAPMessagesS22 - Connecting to Server {0}:{1} with user {2}", Server, Port, Username)
Public Function FetchIMAPMessagesLimilab(Server As String, Port As Integer, Username As String, Password As String, AuthType As String) As Boolean
Try
Logger.Debug("FetchIMAPMessagesS22 - Connecting...")
Using oClient As New S22.Imap.ImapClient(Server, Port, Username, Password, S22.Imap.AuthMethod.Login, True)
If Not oClient.Authed Then
Logger.Warn("FetchIMAPMessagesS22 - Connected to server but authentication failed.")
Logger.Debug("FetchIMAPMessagesLimilab - Fetching messages...")
_limilab.InitIMAP(True, Server, Port, Username, Password, AuthType)
Dim oListuids As New List(Of Long)
oListuids = _limilab.IMAPGetMessageIDs_AllMails()
If IsNothing(oListuids) Then
Return False
End If
Logger.Debug($"FetchIMAPMessagesS22 - Fetching unseen MessageIds from Inbox: {pInbox}")
Dim oMessageIds As IEnumerable(Of UInteger) = oClient.Search(S22.Imap.SearchCondition.Unseen, pInbox)
If oMessageIds.Count > 0 Then
Logger.Info("FetchIMAPMessagesS22 - Found [{0}] messages", oMessageIds.Count)
Logger.Debug("FetchIMAPMessagesS22 - Fetching messages...")
End If
Dim oMessageCountRegular As Integer = 0
Dim oMessageCountWorked As Integer = 0
Dim oLastLog As String
For Each oMessageId As UInteger In oMessageIds
Logger.Debug($"Checking message...")
Dim oMessage = oClient.GetMessage(oMessageId, False, pInbox)
oLastLog = $"Checking message with Subject [{oMessage.Subject}] From [{oMessage.From}]"
Logger.Debug(oLastLog)
Dim oTempPath = Path.GetTempFileName()
Try
Dim oResult = WriteMessageToFile(oMessage, oTempPath)
oLastLog &= $" # Message written to TempPath [{oTempPath}]"
Dim oMessageREFGUID
Dim oMsg As Message
Try
oLastLog &= " # Creating the New Message(oTempPath)"
oMsg = New Message(oTempPath)
oLastLog &= " # Extracting the MessageID"
oMessageREFGUID = oMsg.MessageID
Catch ex As Exception
Logger.Warn($"FetchIMAPMessagesS22 - Could not get a MessageID or create a MailObject - Error: {ex.Message} - Last Debug Log: [{oLastLog}]")
Continue For
End Try
oLastLog &= " # Got the MessageID"
oMessageREFGUID = oMessageREFGUID.Replace(">", "").Replace("<", "")
Dim oCHECKSQL = $"SELECT * FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{oMessageREFGUID}'"
Dim oCHECKDT As DataTable = _DB_MSSQL.Return_Datatable(oCHECKSQL)
If Not IsNothing(oCHECKDT) Then
If oCHECKDT.Rows.Count = 0 Then
oMessageCountRegular += 1
CURRENT_WORKMAIL_LIST.Add(oMsg)
oLastLog &= " # Added to CURRENT_WORKMAIL_LIST"
Else
Logger.Info("FetchIMAPMessagesS22 - Message has already been worked! Skipping!")
Logger.Debug($"Message shall be deleted...")
oLastLog &= " # Message shall be deleted..."
oClient.DeleteMessage(oMessageId)
Logger.Debug($"FetchIMAPMessagesS22 - Message has been deleted!")
oLastLog &= " # FetchIMAPMessagesS22 - Message has been deleted!"
Dim oUpd = $"UPDATE TBEMLP_HISTORY SET DATE_DELETED_INBOX = GETDATE() WHERE EMAIL_MSGID = '{oMessageId}'"
_DB_MSSQL.Execute_non_Query(oUpd)
oMessageCountWorked += 1
End If
If IsTest = True Then
Logger.Debug($"FetchIMAPMessagesS22 - IMAP-Test Message#: {oMessageCountRegular} - Msgsubject is: {oMsg.Subject} - MsgMessageID is: {oMessageREFGUID}")
Logger.Debug($"FetchIMAPMessagesS22 - message correctly fetched. Mail has been downloaded to {oTempPath}")
End If
Try
If DeleteinTest = True Then
Logger.Debug($"Message shall be deleted...")
oClient.DeleteMessage(oMessageId,)
Logger.Debug($"FetchIMAPMessagesS22 - Message has been deleted!")
End If
Catch ex As Exception
Logger.Warn("Message could not be deleted: " & ex.Message)
End Try
If MoveMailTo <> String.Empty Then
Try
Logger.Debug($"Moving to [{MoveMailTo}] is active...")
oClient.MoveMessage(oMessageId, MoveMailTo)
Logger.Debug($"FetchIMAPMessagesS22 - successfully moved!")
Catch ex As Exception
Logger.Warn($"FetchIMAPMessagesS22 - Could not move message to folder [{MoveMailTo}] - Error: {ex.Message}")
End Try
End If
End If
Try
If IsTest = False Then
File.Delete(oTempPath)
End If
Catch ex As Exception
End Try
Catch ex As Exception
Logger.Warn($"FetchIMAPMessages - Unexpected Error while working on email: [{ex.Message}] - Last Debug Log: [{oLastLog}]")
End Try
Next
oClient.Expunge()
Logger.Debug("FetchIMAPMessagesS22 - Finished Message-Fetch")
If oMessageCountRegular > 0 Or oMessageCountWorked > 0 Then
Logger.Info($"###############################################")
If oMessageCountRegular > 0 Then
Logger.Info($"Found [{oMessageCountRegular.ToString}] regular messages to work on!")
End If
If oMessageCountWorked > 0 Then
Logger.Info($"Found [{oMessageCountWorked.ToString}] worked messages to work on!")
End If
If IsTest = True Then
Dim omsgtext As String
If oMessageCountRegular > 0 Then
omsgtext = $"Found [{oMessageCountRegular.ToString}] regular Messages to work on!"
End If
If oMessageCountWorked > 0 Then
If omsgtext = String.Empty Then
Logger.Info($"Found [{oMessageCountWorked.ToString}] worked messages to work on!")
If oListuids.Count > 0 Then
CURRENT_WORKMAIL_UID_LIST = oListuids
Logger.Info("FetchIMAPMessagesLimilab - Found [{0}] messages", oListuids.Count)
CURRENT_ImapObject = _limilab.CurrentImapObject
Else
omsgtext += vbNewLine & $"Found [{oMessageCountWorked.ToString}] worked messages to work on!"
Logger.Debug("FetchIMAPMessagesLimilab - No Emails found!")
End If
End If
MsgBox(omsgtext)
End If
Logger.Info($"###############################################")
End If
End Using
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
''' <summary>
''' Uses a private API from MailWriter to write a MailMessage to disk.
''' May break in future versions of .NET
@ -181,6 +72,4 @@ Public Class clsEmailIMAP
End Try
End Function
End Class

View File

@ -9,12 +9,11 @@ Imports Limilabs.Mail
Imports Limilabs.Mail.MIME
Imports Limilabs.Mail.Headers
Imports MailBox = Limilabs.Mail.Headers.MailBox
Imports DigitalData.Modules.Messaging
'Imports DigitalData.Modules.Messaging
Public Class clsWorkEmail
Private Shared Logger As Logger
Private MyLogger As LogConfig
Private _limilab As DigitalData.Modules.Messaging.Limilab
Private _DB_MSSQL As clsDatabase
Private _USE_WM As Boolean
Private _windream As clsWindream_allgemein
@ -22,12 +21,10 @@ Public Class clsWorkEmail
Private _firebird As Firebird
Private _worked_email As Boolean = False
Private _EmailAccountID As Integer = 1
Sub New(LogConf As LogConfig, ConStr As String, FB_DATASOURCE As String, FB_DATABASE As String, FB_USER As String, FB_PW As String, USE_WM As Boolean, EmailAccountID As Integer)
Sub New(LogConf As LogConfig, ConStr As String, FB_DATASOURCE As String, FB_DATABASE As String, FB_USER As String, FB_PW As String, USE_WM As Boolean, EmailAccountID As Integer, EmlProfPraefix As String)
Try
Logger = LogConf.GetLogger
MyLogger = LogConf
_limilab = New Limilab(LogConf)
Logger.Debug("Limilab initialized")
_DB_MSSQL = New clsDatabase(LogConf, ConStr)
Logger.Debug("clsWorkmail _email initialized")
_USE_WM = USE_WM
@ -40,12 +37,18 @@ Public Class clsWorkEmail
_firebird = New Firebird(LogConf, FB_DATASOURCE, FB_DATABASE, FB_USER, FB_PW)
End If
_EmailAccountID = EmailAccountID
SUBJECT_PRAFIX = EmlProfPraefix
Catch ex As Exception
Logger.Error(ex)
End Try
End Sub
Public Function WorkEmailMessage(MyEmailMessage As IMail) As Boolean
Public Shared Function RemoveIllegalFileNameChars(input As String, Optional replacement As String = "") As String
Dim regexSearch = New String(Path.GetInvalidFileNameChars()) & New String(Path.GetInvalidPathChars())
Dim r = New Regex(String.Format("[{0}]", Regex.Escape(regexSearch)))
Return r.Replace(input, replacement)
End Function
Public Function WorkEmailMessage(MyEmailMessage As IMail, poUID As Long) As Boolean
Try
For Each m As MailBox In MyEmailMessage.From
CURRENT_MAIL_FROM = m.Address
@ -57,8 +60,8 @@ Public Class clsWorkEmail
CURRENT_MAIL_BODY_Substr2 = ""
CURRENT_MAIL_MESSAGE = MyEmailMessage
CURRENT_MAIL_SUBJECT = MyEmailMessage.Subject.ToUpper
CURRENT_MAIL_MESSAGE_ID = MyEmailMessage.MessageID
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
@ -66,7 +69,10 @@ Public Class clsWorkEmail
CURRENT_MAIL_MESSAGE_ID = System.Guid.NewGuid.ToString()
End If
End If
CURRENT_MAIL_MESSAGE_ID.Replace(">", "").Replace("<", "")
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
CURRENT_MAIL_SUBJECT = ""
Else
@ -75,6 +81,12 @@ Public Class clsWorkEmail
Logger.Debug($"Working on email from : {CURRENT_MAIL_FROM}...")
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!")
Return True
End If
Dim oTempMailExists As Boolean = SAVE2TEMP()
'Checking wether Mail can be opened
Dim oTempMailAccessible As Boolean = False
@ -82,6 +94,7 @@ Public Class clsWorkEmail
Try
Dim oFS As FileStream = File.OpenRead(CURRENT_TEMP_MAIL_PATH)
oTempMailAccessible = True
oFS.Close()
Catch ex As Exception
Logger.Warn($"Could not read the Temp-Mail. Insufficient rights? Message: {ex.Message}")
End Try
@ -98,8 +111,9 @@ Public Class clsWorkEmail
If CURRENT_ATTMT_COUNT = 0 Then
Logger.Info("### Mail contained no Attachments!! ###")
Dim oBody = EmailStrings.EMAIL_NO_FERDS
Dim oMessagId = CURRENT_MAIL_MESSAGE.MessageID.Replace("<", "").Replace(">", "")
AddToEmailQueueMSSQL(oMessagId, oBody, "No Attachments", _EmailAccountID)
If AddToEmailQueueMSSQL(CURRENT_MAIL_MESSAGE_ID, oBody, "No Attachments", _EmailAccountID) = True Then
CURRENT_ImapObject.DeleteMessageByUID(poUID)
End If
End If
Return True
Else
@ -115,78 +129,13 @@ Public Class clsWorkEmail
Return False
End Try
End Function
Public Function WorkEmailMessageLimi(MyEmailMessage As IMail) As Boolean
Try
CURRENT_MAIL_BODY_ALL = ""
CURRENT_MAIL_BODY_ANSWER1 = ""
CURRENT_MAIL_BODY_Substr2 = ""
CURRENT_MAIL_MESSAGE = MyEmailMessage
CURRENT_MAIL_SUBJECT = MyEmailMessage.Subject.ToUpper
For Each m As MailBox In MyEmailMessage.From
CURRENT_MAIL_FROM = m.Address
Next
Logger.Debug($"Working on email from: {MyEmailMessage.From.ToString}...Subject: {MyEmailMessage.Subject}")
If IsNothing(CURRENT_MAIL_SUBJECT) Then
CURRENT_MAIL_SUBJECT = ""
Else
Logger.Debug($"Subject: {CURRENT_MAIL_SUBJECT}...")
End If
Logger.Debug($"Working on email from : {CURRENT_MAIL_FROM}...")
Dim oTempMailExists As Boolean = SAVE2TEMP()
'Checking wether Mail can be opened
Dim oTempMailAccessible As Boolean = False
If oTempMailExists = True Then
Try
Dim oFS As FileStream = File.OpenRead(CURRENT_TEMP_MAIL_PATH)
oTempMailAccessible = True
Catch ex As Exception
Logger.Warn($"Could not read the Temp-Mail. Insufficient rights? Message: {ex.Message}")
End Try
If oTempMailAccessible = True Then
MessageError = False
If CURRENT_MAIL_SUBJECT.Contains("[PROCESSMANAGER]") Then
PROCESS_MANAGER_IN()
ElseIf MyEmailMessage.Subject.Contains("[ADDI]") Then
Else
Logger.Info("CommonEmail-Process-Sniffer")
If COMMON_EMAIL_IN() = True Then
INSERT_HISTORY_MSSQL()
If CURRENT_ATTMT_COUNT = 0 Then
Logger.Info("### Mail contained no Attachments!! ###")
Dim oBody = EmailStrings.EMAIL_NO_FERDS
Dim oMessagId = CURRENT_MAIL_MESSAGE.MessageID.Replace("<", "").Replace(">", "")
AddToEmailQueueMSSQL(oMessagId, oBody, "No Attachments", _EmailAccountID)
End If
Return True
Else
Return False
End If
End If
End If
End If
Catch ex As Exception
Logger.Error(ex)
'clsLogger.Add("Unexpected Error in WORK_MAIL: " & ex.Message & "MESSAGE_ID: " & msg.MessageID)
Return False
End Try
End Function
Public Sub AddToEmailQueueMSSQL(MessageId As String, BodyText As String, SourceProcedure As String, pEmailAccountId As Integer)
Public Function AddToEmailQueueMSSQL(MessageId As String, BodyText As String, SourceProcedure As String, pEmailAccountId As Integer) As Boolean
Try
Dim oReference = MessageId
Dim oEmailTo = ""
Dim oSubject = $"{My.Settings.PraefixSubject} - {EmailStrings.EMAIL_SUBJECT_REJECTED}"
Dim oSubject = $"{SUBJECT_PRAFIX} - {EmailStrings.EMAIL_SUBJECT_REJECTED}"
Dim oCreatedWho = "DDEmailProfiler"
Dim oMaskedBodyText = BodyText.Replace("'", "''")
@ -235,17 +184,18 @@ Public Class clsWorkEmail
,'{oFinalBodyText}'
,'{SourceProcedure}'
,'{oCreatedWho}')"
_DB_MSSQL.Execute_non_Query(oInsert)
Return _DB_MSSQL.Execute_non_Query(oInsert)
Else
Logger.Warn($"!! Could not get oHistoryID in AddToEmailQueueMSSQL [{osql}]")
End If
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Sub
End Function
Private Function PROCESS_MANAGER_IN() As Boolean
Try
Dim oDel_email As Boolean = False
Logger.Info(String.Format("PM-related message found....[{0}]", CURRENT_MAIL_MESSAGE.Subject))
Logger.Debug(String.Format("PM-related message found....[{0}]", CURRENT_MAIL_MESSAGE.Subject))
Dim oExpression = "PROCESS_NAME = 'ProcessManager'"
@ -265,7 +215,7 @@ Public Class clsWorkEmail
WM_OBJEKTTYPE = row("WM_OBJEKTTYPE")
WM_IDX_BODY_TEXT = row("WM_IDX_BODY_TEXT")
WM_IDX_BODY_SUBSTR_LENGTH = row("WM_IDX_BODY_SUBSTR_LENGTH")
oDel_email = row("DELETE_MAIL")
DeleteMail = row("DELETE_MAIL")
If COPY2HDD(row("COPY_2_HDD"), row("PATH_ORIGINAL"), row("PATH_EMAIL_ERRORS"), False) = True Then
EXTRACT_BODY()
@ -293,9 +243,7 @@ Public Class clsWorkEmail
End If
End If
If ClassCurrent.CURRENT_DEBUG_LOCAL_EMAIL = "" Then
EMAIL_DELETE(oDel_email)
End If
End If
Return True
@ -307,7 +255,7 @@ Public Class clsWorkEmail
End Function
Function COMMON_EMAIL_IN() As Boolean
Try
Dim oDel_email As Boolean = False
Logger.Info(String.Format("COMMON_EMAIL_IN...Subject [{0}]", CURRENT_MAIL_MESSAGE.Subject))
Logger.Debug(String.Format("COMMON_EMAIL_IN...Subject [{0}]", CURRENT_MAIL_MESSAGE.Subject))
Dim oExpression = "PROCESS_NAME = 'Attachment Sniffer' or PROCESS_NAME = 'ZugFeRD-Parser'"
@ -315,9 +263,12 @@ Public Class clsWorkEmail
'Filter the rows using Select() method of DataTable
Dim TEMP_PROCESS_PROFILE_DT As DataTable = DT_POLL_PROCESS
Dim PM_ROW As DataRow() = TEMP_PROCESS_PROFILE_DT.Select(oExpression)
If PM_ROW.Length = 0 Then
Logger.Info("ATTENTION: NO PROCESS-Definititon Filter [PROCESS_NAME = 'Attachment Sniffer' or PROCESS_NAME = 'ZugFeRD-Parser'] returned 0")
Return False
End If
For Each oDataRow As DataRow In PM_ROW
oDel_email = oDataRow("DELETE_MAIL")
DeleteMail = oDataRow("DELETE_MAIL")
CURRENT_MAIL_PROCESS_NAME = oDataRow.Item("PROCESS_NAME")
Try
WM_REFERENCE_INDEX = oDataRow("WM_REFERENCE_INDEX")
@ -337,6 +288,7 @@ Public Class clsWorkEmail
If COPY2HDD(oDataRow("COPY_2_HDD"), oDataRow("PATH_ORIGINAL"), oDataRow("PATH_EMAIL_ERRORS"), True) = True Then
If EXTRACT_ATTACHMENTS(oDataRow("PATH_EMAIL_TEMP"), oDataRow("PATH_EMAIL_ERRORS")) = True Then
Return True
Else
Logger.Warn("!##Returning false from EXTRACT_ATTACHMENTS!##")
@ -348,9 +300,7 @@ Public Class clsWorkEmail
Next
If ClassCurrent.CURRENT_DEBUG_LOCAL_EMAIL = "" Then
EMAIL_DELETE(oDel_email)
End If
Return True
Catch ex As Exception
@ -359,14 +309,13 @@ Public Class clsWorkEmail
Return False
End Try
End Function
Private Function SAVE2TEMP()
Try
Dim oTempPath As String = Path.Combine(Path.GetTempPath, "DD_EmailProfiler")
Logger.Debug($"oTempPath is: {oTempPath} ...")
If Directory.Exists(oTempPath) = False Then
Directory.CreateDirectory(oTempPath)
Else
Logger.Debug($"SAVE2TEMP - oTempPath [{oTempPath}] is already existing!!")
End If
Dim oFileEntries As String() = Directory.GetFiles(oTempPath)
' Process the list of files found in the directory.
@ -377,17 +326,24 @@ Public Class clsWorkEmail
Catch ex As Exception
End Try
Next oFileName
Dim oResult As Boolean = False
Dim oTempFilename As String = Path.Combine(oTempPath, CURRENT_MAIL_MESSAGE.Subject.Replace(" ", "") & ".eml")
Dim oCounter As Integer = 1
Dim oSubjectFilename = CURRENT_MAIL_MESSAGE.Subject & ".eml"
Logger.Debug($"oSubjectFilename (beforeclean) is: {oSubjectFilename}")
oSubjectFilename = RemoveIllegalFileNameChars(oSubjectFilename)
Dim oTempFilename = oTempPath & "\" & oSubjectFilename
Logger.Debug($"oTempFilename (afterclean) is: {oTempFilename}")
If File.Exists(oTempFilename) = True Then
Do While File.Exists(oTempFilename)
oCounter += 1
oTempFilename = Path.Combine(oTempPath, oCounter & "_" & CURRENT_MAIL_MESSAGE.Subject.Replace(" ", "") & ".eml")
Loop
End If
Dim oCounter As Integer = 1
'If File.Exists(oTempFilename) = True Then
' Do While File.Exists(oTempFilename)
' oCounter += 1
' oTempFilename = Path.Combine(oTempPath, oCounter & "_" & CURRENT_MAIL_MESSAGE.Subject.Replace(" ", "") & ".eml")
' oTempFilename = String.Join("", oTempFilename.Split(Path.GetInvalidPathChars()))
' oTempFilename = oTempFilename.Replace("/", "")
' oTempFilename = oTempFilename.Replace("\", "")
' Loop
'End If
CURRENT_MAIL_MESSAGE.Save(oTempFilename)
CURRENT_TEMP_MAIL_PATH = oTempFilename
Logger.Debug($"Email saved to Temppath {CURRENT_TEMP_MAIL_PATH}")
@ -427,30 +383,30 @@ Public Class clsWorkEmail
If Directory.Exists(pathOriginal) Then
Dim oTempFilename = pathOriginal
If messageid = True Then
oTempFilename &= "\" & CURRENT_MAIL_MESSAGE.MessageID & ".eml"
oTempFilename &= "\" & CURRENT_MAIL_MESSAGE_ID & ".eml"
Else
oTempFilename &= "\" & CURRENT_MAIL_MESSAGE.Subject.Replace(" ", "") & ".eml"
End If
Dim cleanPath As String = String.Join("", oTempFilename.Split(Path.GetInvalidPathChars()))
If System.IO.File.Exists(cleanPath) = False Then
'Dim cleanPath As String = String.Join("", oTempFilename.Split(Path.GetInvalidPathChars()))
If System.IO.File.Exists(oTempFilename) = False Then
Try
File.Delete(cleanPath)
File.Delete(oTempFilename)
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
CURRENT_MAIL_MESSAGE.Save(cleanPath)
Dim oFileInfo As New FileInfo(cleanPath)
CURRENT_MAIL_MESSAGE.Save(oTempFilename)
Dim oFileInfo As New FileInfo(oTempFilename)
Dim oFileLenth As Long = oFileInfo.Length
If oFileLenth > 0 Then
Logger.Info($"[COPY2HDD] Email saved to ({cleanPath})")
Logger.Info($"[COPY2HDD] Email saved to ({oTempFilename})")
Return True
Else
Logger.Warn($"##!! oFileLenth is 0 !!##")
Try
File.Delete(cleanPath)
File.Delete(oTempFilename)
Catch ex As Exception
Logger.Error(ex)
End Try
@ -458,7 +414,7 @@ Public Class clsWorkEmail
End If
Else
Logger.Info("COPY2HDD (" & CURRENT_MAIL_MESSAGE.Subject & ") already existing in [{cleanPath}]!", False, "RUN_THREAD.COPY_2_HDD")
Logger.Info("COPY2HDD (" & CURRENT_MAIL_MESSAGE.Subject & ") already existing in [{oTempFilename}]!", False, "RUN_THREAD.COPY_2_HDD")
Return True
End If
End If
@ -654,12 +610,12 @@ Public Class clsWorkEmail
If File.Exists(CURRENT_TEMP_MAIL_PATH) Then
' Dim oCurrentMail As New Independentsoft.Email.Mime.Message(CURRENT_TEMP_MAIL_PATH)
For Each mime As MimeData In CURRENT_MAIL_MESSAGE.Attachments
mime.Save(mime.SafeFileName)
Next
'For Each mime As MimeData In CURRENT_MAIL_MESSAGE.Attachments
' mime.Save(mime.SafeFileName)
'Next
For Each mime As MimeData In CURRENT_MAIL_MESSAGE.Attachments
' For Each oAttachment As Attachment In oCurrentMail.GetAttachments
Dim oATTFilename = mime.SafeFileName 'oAttachment.GetFileName.ToString.ToLower
Dim oATTFilename = mime.SafeFileName.ToString.ToLower 'oAttachment.GetFileName.ToString.ToLower
Dim oValidExt As Boolean = False
If oATTFilename.EndsWith("pdf") Then
oValidExt = True
@ -837,26 +793,7 @@ Public Class clsWorkEmail
End Try
End Function
'Private Function GetChildren(ByVal bodyParts As BodyPartCollection) As BodyPartCollection
' Dim children As New BodyPartCollection()
' For i As Integer = 0 To bodyParts.Count - 1
' children.Add(GetChildren(bodyParts(i).BodyParts))
' children.Add(bodyParts(i))
' Next
' Return children
'End Function
Private Function EMAIL_DELETE(del As Boolean)
If del = True And MessageError = False Then
_limilab.DeleteMessageByUID(CURRENT_MAIL_MESSAGE_ID)
Else
If MessageError = True Then
Logger.Warn($"Did not delete Message [{CURRENT_MAIL_MESSAGE.MessageID}] as there was an MessageError!")
End If
End If
End Function
Private Function WORK_POLL_STEPS() As Boolean
Try
Dim oFoundSomething As Boolean = False

View File

@ -7,7 +7,7 @@ Imports Limilabs.Mail.MIME
Imports Limilabs.Mail.Headers
Public Class clsWorker
Private Shared Logger As Logger
Private MyLogger As LogConfig
Private MyLogConfig As LogConfig
'Private _email As clsEmail
Private _emailIMAP As clsEmailIMAP
Private _Database As clsDatabase
@ -17,12 +17,11 @@ Public Class clsWorker
Private _workmail As clsWorkEmail
Private _wrapper As clsEncryption
Private _POLL_PROFILEID As Integer = 0
Private _limilab As DigitalData.Modules.Messaging.Limilab
Dim cs As String
Sub New(LogConf As LogConfig, ConStr As String, POLL_PROFILEID As Integer, FB_DATASOURCE As String, FB_DATABASE As String, FB_USER As String, FB_PW As String, USE_WM As Boolean, EmailAccountID As Integer, Optional plocaleml As String = "")
Sub New(LogConf As LogConfig, ConStr As String, POLL_PROFILEID As Integer, FB_DATASOURCE As String, FB_DATABASE As String, FB_USER As String, FB_PW As String, USE_WM As Boolean, EmailAccountID As Integer, EmlProfPraefix As String, Optional plocaleml As String = "")
MyLogConfig = LogConf
Logger = LogConf.GetLogger
_limilab = New Limilab(LogConf)
' _email = New clsEmail(LogConf)
_emailIMAP = New clsEmailIMAP(LogConf, ConStr)
_Database = New clsDatabase(LogConf, ConStr)
cs = ConStr
@ -32,20 +31,12 @@ Public Class clsWorker
_windream_index = New clsWindream_Index(LogConf)
End If
_workmail = New clsWorkEmail(LogConf, ConStr, FB_DATASOURCE, FB_DATABASE, FB_USER, FB_PW, USE_WM, EmailAccountID)
_workmail = New clsWorkEmail(LogConf, ConStr, FB_DATASOURCE, FB_DATABASE, FB_USER, FB_PW, USE_WM, EmailAccountID, EmlProfPraefix)
_wrapper = New clsEncryption("!35452didalog=", LogConf)
_POLL_PROFILEID = POLL_PROFILEID
ClassCurrent.CURRENT_DEBUG_LOCAL_EMAIL = plocaleml
End Sub
Public Sub Debug_Local_Email()
Try
Catch ex As Exception
End Try
End Sub
Public Sub Start_WorkingProfiles(Optional LocalEmail As Boolean = False)
Try
TEMP_FILES.Clear()
@ -117,6 +108,7 @@ Public Class clsWorker
MAIL_PORT = row("PORT_IN")
MAIL_INBOX_NAME = "Inbox"
MAIL_ARCHIVE_FOLDER = row("ARCHIVE_FOLDER")
MAIL_AUTHTYPE = row("AUTH_TYPE")
Logger.Debug(String.Format("{0}-{1}", MAIL_FROM, MAIL_SERVER))
Dim PWPlain = _wrapper.DecryptData(MAIL_USER_PW)
@ -131,16 +123,13 @@ Public Class clsWorker
End If
Next
CURRENT_WORKMAIL_LIST.Clear()
CURRENT_WORKMAIL_UID_LIST.Clear()
If MAIL_SERVER <> "" Then
Dim pollresult As Boolean = False
If LocalEmail = True Then
pollresult = True
Dim oEmail As IMail = New MailBuilder().CreateFromEmlFile(CURRENT_DEBUG_LOCAL_EMAIL)
Dim oMessage As New Message(CURRENT_DEBUG_LOCAL_EMAIL)
CURRENT_WORKMAIL_LIST.Add(oMessage)
CURRENT_WORKMAIL_LIST.Add(oEmail)
Else
Select Case CURRENT_POLL_TYPE
Case "POP"
@ -148,36 +137,51 @@ Public Class clsWorker
Case "IMAP"
'pollresult = _emailIMAP.IMAP_COLLECT()
'pollresult = _emailIMAP.FetchIMAPMessagesIsoft(MAIL_SERVER, MAIL_PORT, MAIL_USER, MAIL_USER_PW, MAIL_INBOX_NAME, MAIL_ARCHIVE_FOLDER)
pollresult = _emailIMAP.FetchIMAPMessagesS22(MAIL_SERVER, MAIL_PORT, MAIL_USER, MAIL_USER_PW, MAIL_INBOX_NAME)
pollresult = _emailIMAP.FetchIMAPMessagesLimilab(MAIL_SERVER, MAIL_PORT, MAIL_USER, MAIL_USER_PW, MAIL_AUTHTYPE)
End Select
End If
'If pollresult = False Then
' Logger.Info(String.Format("Error while polling emails...Trying S22...."))
' pollresult = _emailIMAP.FetchIMAPMessages(MAIL_SERVER, MAIL_PORT, MAIL_USER, MAIL_USER_PW, MAIL_INBOX_NAME)
' If pollresult = False Then
' Logger.Warn(String.Format("FetchIMAPMessagesS22 - also returned error!"))
' End If
'End If
If CURRENT_WORKMAIL_LIST.Count() > 0 Then
Logger.Info(String.Format("Worked/Pulled: [{0}] E-Mails", CURRENT_WORKMAIL_LIST.Count()))
If CURRENT_WORKMAIL_UID_LIST.Count() > 0 Or LocalEmail = True Then
If LocalEmail Then
Logger.Info("Working with local Mail")
Dim oEmail As IMail = New MailBuilder().CreateFromEmlFile(CURRENT_DEBUG_LOCAL_EMAIL)
_workmail.WorkEmailMessage(oEmail, 123456789)
CURRENT_MAIL_MESSAGE = Nothing
Else
Try
'For Each pulled_msg As Message In CURRENT_WORKMAIL_LIST
' _workmail.WorkEmailMessage(pulled_msg)
' CURRENT_MAIL_MESSAGE = Nothing
'Next
For Each pulled_msg As IMail In CURRENT_WORKMAIL_LIST
_workmail.WorkEmailMessage(pulled_msg)
Logger.Info(String.Format("Pulled: [{0}] E-Mails", CURRENT_WORKMAIL_UID_LIST.Count()))
For Each oUID In CURRENT_WORKMAIL_UID_LIST
Dim oEml = CURRENT_ImapObject.GetMessageByUID(oUID)
Dim oEmail As IMail = New MailBuilder().CreateFromEml(oEml)
If Not IsNothing(oEmail) Then
If _workmail.WorkEmailMessage(oEmail, oUID) = True Then
If ClassCurrent.CURRENT_DEBUG_LOCAL_EMAIL = "" Then
EMAIL_DELETE()
End If
End If
Else
Logger.Info("### oEmail was nothing ###")
End If
CURRENT_MAIL_MESSAGE = Nothing
Next
If CURRENT_POLL_TYPE = "IMAP" And CURRENT_WORKMAIL_UID_LIST.Count > 0 Then
If Not IsNothing(CURRENT_ImapObject) Then
CURRENT_ImapObject.Close()
End If
End If
Catch ex As Exception
Logger.Error(ex)
Logger.Warn($"Error converting CURRENT_WORKMAIL_LIST to IsoftMesage: {ex.Message} ")
Logger.Warn($"Unexpected Error working CURRENT_WORKMAIL_UID_LIST: {ex.Message} ")
End Try
End If
Else
Logger.Debug(String.Format("No emails for profile!"))
End If
Else
Logger.Warn("For the Email-Profile ID " & CURRENT_EMAIL_GUID & " no record could be found!")
End If
@ -201,23 +205,6 @@ Public Class clsWorker
End Try
End If
Next
'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
' Try
' fi.Delete()
' Catch ex As Exception
' Logger.Warn($"TempFileDelete2 - Could not delete the tempfile: {ex.Message}")
' End Try
' Next
'Catch ex As Exception
' Logger.Warn($"TempFileDelete3 - Could not delete the tempfile: {ex.Message}")
'End Try
Catch ex As Exception
Logger.Warn($"TempFileDelete(X) - Could not delete the tempfile from TEMP_FILES: {ex.Message}")
@ -234,4 +221,18 @@ Public Class clsWorker
Logger.Error(ex)
End Try
End Sub
Private Function EMAIL_DELETE()
If DeleteMail = True And MessageError = False Then
If Not IsNothing(CURRENT_ImapObject) Then
CURRENT_ImapObject.DeleteMessageByUID(CURRENT_MAIL_UID)
Else
Logger.Warn("EMAIL_DELETE - CURRENT_ImapObject is nothing")
End If
Else
If MessageError = True Then
Logger.Warn($"Did not delete Message with UID [{CURRENT_MAIL_UID}] as there was an MessageError!")
End If
End If
End Function
End Class

View File

@ -1 +1 @@
24d36d8793b73fae098b106b4d1e325ae023f116
2ccc3133aa6c37a6343d615f291113d83df59e73

View File

@ -28,39 +28,32 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.EMLProfiler.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\AE.Net.Mail.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Database.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Filesystem.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Logging.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Messaging.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\Independentsoft.Msg.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\Interop.WINDREAMLib.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\Mail.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\NLog.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\S22.Imap.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\FirebirdSql.Data.FirebirdClient.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\Oracle.ManagedDataAccess.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Encryption.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\Independentsoft.Email.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Filesystem.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Language.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\protobuf-net.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Language.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\AE.Net.Mail.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Database.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Database.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Database.dll.config
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Filesystem.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Filesystem.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Logging.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Logging.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Messaging.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Messaging.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\Independentsoft.Msg.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\S22.Imap.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Encryption.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Encryption.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\Independentsoft.Email.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Filesystem.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Filesystem.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\protobuf-net.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Language.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.Modules.Language.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\protobuf-net.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.vbproj.AssemblyReference.cache
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.Resources.resources
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.vbproj.GenerateResource.cache
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.vbproj.CoreCompileInputs.cache

View File

@ -35,6 +35,9 @@
<setting name="EmailAccountID" serializeAs="String">
<value>2</value>
</setting>
<setting name="EmailProfilerPraefix" serializeAs="String">
<value>EmailProfiler</value>
</setting>
</SERV_EMAIL.My.MySettings>
</applicationSettings>
</configuration>

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: AssemblyVersion("2.5.1.0")>
<Assembly: AssemblyFileVersion("2.5.1.0")>

View File

@ -127,6 +127,15 @@ Namespace My
Return CType(Me("EmailAccountID"),Integer)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("EmailProfiler")> _
Public ReadOnly Property EmailProfilerPraefix() As String
Get
Return CType(Me("EmailProfilerPraefix"),String)
End Get
End Property
End Class
End Namespace

View File

@ -31,5 +31,8 @@
<Setting Name="EmailAccountID" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">2</Value>
</Setting>
<Setting Name="EmailProfilerPraefix" Type="System.String" Scope="Application">
<Value Profile="(Default)">EmailProfiler</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -10,7 +10,6 @@ Public Class MyService
Private MyLogger As LogConfig
Private Logger As Logger
Private _database As clsDatabase
Private _email As clsEmail
Private _windream As clsWindream_allgemein
Private _workmail As clsWorkEmail
#End Region
@ -52,10 +51,9 @@ Public Class MyService
End If
_database = New clsDatabase(MyLogger, My.Settings.MyConnectionString)
_email = New clsEmail(MyLogger)
Logger.Debug("_database and _email initialized")
_workmail = New clsWorkEmail(MyLogger, My.Settings.MyConnectionString, My.Settings.FB_DATASOURCE, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW,
My.Settings.USE_WM, My.Settings.EmailAccountID)
My.Settings.USE_WM, My.Settings.EmailAccountID, My.Settings.EmailProfilerPraefix)
Logger.Debug("_workmail initialized")
If _database.Init(My.Settings.MyConnectionString) = False Then
Logger.Warn("ATTENTION: No Connection was established '" & My.Settings.MyConnectionString & "'!")
@ -90,7 +88,7 @@ Public Class MyService
Public Sub RUN_THREAD(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
Try
Dim notcompleted As Boolean = False
Dim _work As New clsWorker(MyLogger, My.Settings.MyConnectionString, 0, My.Settings.FB_DATASOURCE, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW, My.Settings.USE_WM, My.Settings.EmailAccountID)
Dim _work As New clsWorker(MyLogger, My.Settings.MyConnectionString, 0, My.Settings.FB_DATASOURCE, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW, My.Settings.USE_WM, My.Settings.EmailAccountID, My.Settings.EmailProfilerPraefix)
_work.Start_WorkingProfiles()
Catch ex As Exception
Logger.Error(ex)

View File

@ -47,9 +47,9 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="DigitalData.EMLProfiler, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="DigitalData.EMLProfiler, Version=3.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DigitalData.EMLProfiler\bin\Release\DigitalData.EMLProfiler.dll</HintPath>
<HintPath>..\DigitalData.EMLProfiler\bin\Debug\DigitalData.EMLProfiler.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging, Version=0.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@ -35,6 +35,9 @@
<setting name="EmailAccountID" serializeAs="String">
<value>2</value>
</setting>
<setting name="EmailProfilerPraefix" serializeAs="String">
<value>EmailProfiler</value>
</setting>
</SERV_EMAIL.My.MySettings>
</applicationSettings>
</configuration>

View File

@ -1 +1 @@
4449f7d03a18e13b7eb0ee8590d9e72ae625781d
cea1fa609f67c5a2d096053c2a7f87e6739c097c

View File

@ -23,22 +23,32 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\Digita
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\Independentsoft.Email.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\Interop.WINDREAMLib.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\NLog.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\S22.Imap.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\Mail.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Messaging.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Database.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Filesystem.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Language.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\FirebirdSql.Data.FirebirdClient.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\Oracle.ManagedDataAccess.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Encryption.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\protobuf-net.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.EMLProfiler.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.EMLProfiler.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.EMLProfiler.dll.config
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Logging.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Logging.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\S22.Imap.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Messaging.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Messaging.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Database.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Database.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Database.dll.config
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Filesystem.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Filesystem.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Language.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Language.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Encryption.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\DigitalData.Modules.Encryption.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\bin\Debug\protobuf-net.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\obj\Debug\SERV_EMAIL.vbproj.AssemblyReference.cache
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\obj\Debug\SERV_EMAIL.Resources.resources
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\SERV_EMAIL\obj\Debug\SERV_EMAIL.MyService.resources