IMAP Collect als Testfunction integriert
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -22,6 +22,12 @@ DigitalData.EMLProfiler
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DigitalData.EMLProfiler.clsEmailIMAP.WriteMessageToFile(System.Net.Mail.MailMessage,System.String)">
|
||||
<summary>
|
||||
Uses a private API from MailWriter to write a MailMessage to disk.
|
||||
May break in future versions of .NET
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DigitalData.EMLProfiler.clsWindream_allgemein.#ctor(DigitalData.Modules.Logging.LogConfig)">
|
||||
<summary>
|
||||
Konstruktor für die windream-Klasse
|
||||
|
||||
BIN
App/DigitalData.EMLProfiler/bin/Debug/S22.Imap.dll
Normal file
BIN
App/DigitalData.EMLProfiler/bin/Debug/S22.Imap.dll
Normal file
Binary file not shown.
7178
App/DigitalData.EMLProfiler/bin/Debug/S22.Imap.xml
Normal file
7178
App/DigitalData.EMLProfiler/bin/Debug/S22.Imap.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -18,38 +18,38 @@ Public Class clsEmailIMAP
|
||||
' Logger.Info(e.Log)
|
||||
'End Sub
|
||||
|
||||
Public Function TestIMAPLogin(Server As String, Port As Integer, Username As String, Password As String, Inbox As String) As Boolean
|
||||
Logger.Debug("Testing Login to Server {0}:{1} with user {2}", Server, Port, Username)
|
||||
'Public Function TestIMAPLogin(Server As String, Port As Integer, Username As String, Password As String, Inbox As String) As Boolean
|
||||
' Logger.Debug("Testing Login to Server {0}:{1} with user {2}", Server, Port, Username)
|
||||
|
||||
Try
|
||||
Logger.Debug("Connecting...")
|
||||
Using oClient As New S22.Imap.ImapClient(Server, Port, Username, Password, S22.Imap.AuthMethod.Login, True)
|
||||
If Not oClient.Authed Then
|
||||
Logger.Warn("Connected to server but authentication failed.")
|
||||
Return False
|
||||
End If
|
||||
Logger.Debug("Connection successful")
|
||||
' Try
|
||||
' Logger.Debug("Connecting...")
|
||||
' Using oClient As New S22.Imap.ImapClient(Server, Port, Username, Password, S22.Imap.AuthMethod.Login, True)
|
||||
' If Not oClient.Authed Then
|
||||
' Logger.Warn("Connected to server but authentication failed.")
|
||||
' Return False
|
||||
' End If
|
||||
' Logger.Debug("Connection successful")
|
||||
|
||||
Logger.Debug("Fetching MessageIds..")
|
||||
Dim oMessageIds As IEnumerable(Of UInteger) = oClient.Search(S22.Imap.SearchCondition.Unseen, Inbox)
|
||||
' Logger.Debug("Fetching MessageIds..")
|
||||
' Dim oMessageIds As IEnumerable(Of UInteger) = oClient.Search(S22.Imap.SearchCondition.Unseen, Inbox)
|
||||
|
||||
Logger.Debug("Found {0} messages", oMessageIds.Count)
|
||||
Logger.Debug("Fetching messages...")
|
||||
' Logger.Debug("Found {0} messages", oMessageIds.Count)
|
||||
' Logger.Debug("Fetching messages...")
|
||||
|
||||
Dim oMessages As IEnumerable(Of Mail.MailMessage) = oClient.GetMessages(oMessageIds, False, Inbox)
|
||||
Logger.Debug("Messages fetched")
|
||||
' Dim oMessages As IEnumerable(Of Mail.MailMessage) = oClient.GetMessages(oMessageIds, False, Inbox)
|
||||
' Logger.Debug("Messages fetched")
|
||||
|
||||
oClient.Dispose()
|
||||
' oClient.Dispose()
|
||||
|
||||
Return True
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
' Return True
|
||||
' End Using
|
||||
' Catch ex As Exception
|
||||
' Logger.Error(ex)
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Public Function FetchIMAPMessages(Server As String, Port As Integer, Username As String, Password As String, Inbox As String) As Boolean
|
||||
Public Function FetchIMAPMessages(Server As String, Port As Integer, Username As String, Password As String, Inbox As String, Optional IsTest As Boolean = False) As Boolean
|
||||
Logger.Debug("Connecting to Server {0}:{1} with user {2}", Server, Port, Username)
|
||||
|
||||
Try
|
||||
@@ -73,12 +73,20 @@ Public Class clsEmailIMAP
|
||||
Dim oResult = WriteMessageToFile(oMessage, oTempPath)
|
||||
|
||||
Dim oMsg As New Message(oTempPath)
|
||||
MAIL_LIST.Add(oMsg)
|
||||
If IsTest = False Then
|
||||
MAIL_LIST.Add(oMsg)
|
||||
Else
|
||||
Logger.Debug($"message correctly fetched. Mail has been downloaded to {oTempPath}")
|
||||
End If
|
||||
|
||||
|
||||
Try
|
||||
File.Delete(oTempPath)
|
||||
If IsTest = False Then
|
||||
File.Delete(oTempPath)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Logger.Warn("Temp file could not be deleted")
|
||||
End Try
|
||||
Next
|
||||
@@ -199,43 +207,5 @@ Public Class clsEmailIMAP
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Public Function TEST_AEIMAP_COLLECT(INBOXNAME As String, MYMAIL_SERVER As String, MYMAIL_PORT As Integer, MYMAIL_USER As String, MYMAIL_USER_PW As String)
|
||||
Try
|
||||
Logger.Info(String.Format("Working on TEST_AEIMAP_COLLECT....."))
|
||||
'Dim oLogPath = System.IO.Path.Combine(My.Application.Info.DirectoryPath, "Log\logindependentSoft.txt")
|
||||
'Logger.Debug($"IsoftLog: {oLogPath}...")
|
||||
'Dim oindependentLogger As New Independentsoft.Email.Logger(oLogPath)
|
||||
' Dim sslProtocol As System.Security.Authentication.SslProtocols = Security.Authentication.SslProtocols.Default
|
||||
Dim oImapClient As New AE.Net.Mail.ImapClient(MYMAIL_SERVER, MYMAIL_USER, MYMAIL_USER_PW, AE.Net.Mail.AuthMethods.Login, MYMAIL_PORT)
|
||||
'oImapClient.Logger = oindependentLogger
|
||||
'oImapClient.ValidateRemoteCertificate = False
|
||||
Try
|
||||
If (oImapClient.IsConnected) Then
|
||||
Logger.Debug($"oImapClient Login successfull...")
|
||||
Else
|
||||
Logger.Info($"oImapClient NOT connected...")
|
||||
Return False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex.Message)
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
oImapClient.Disconnect()
|
||||
|
||||
|
||||
|
||||
Logger.Info("TEST_IMAP_COLLECT finished!")
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Info($"Unexpected error in TEST_IMAP_COLLECT - User: [{MYMAIL_USER}] PW: [{MYMAIL_USER_PW}]")
|
||||
Logger.Error(ex, "Unexpected Error in TEST_IMAP_COLLECT:")
|
||||
MsgBox($"Unexpected error in TEST_IMAP_COLLECT: {ex.Message}")
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
e16852c9dcabf8ca2116c0fea0baeab31771f4e2
|
||||
064839440650a653f8e769d63390527023957743
|
||||
|
||||
@@ -2,13 +2,16 @@ 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.dll
|
||||
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\DigitalData.EMLProfiler.pdb
|
||||
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.Logging.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\Interop.WINDREAMLib.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\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
|
||||
@@ -16,6 +19,7 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin
|
||||
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\Independentsoft.Email.xml
|
||||
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin\Debug\NLog.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\FirebirdSql.Data.FirebirdClient.pdb
|
||||
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
|
||||
@@ -24,5 +28,3 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj
|
||||
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.dll
|
||||
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.xml
|
||||
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.pdb
|
||||
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\AE.Net.Mail.pdb
|
||||
|
||||
Binary file not shown.
@@ -22,6 +22,12 @@ DigitalData.EMLProfiler
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DigitalData.EMLProfiler.clsEmailIMAP.WriteMessageToFile(System.Net.Mail.MailMessage,System.String)">
|
||||
<summary>
|
||||
Uses a private API from MailWriter to write a MailMessage to disk.
|
||||
May break in future versions of .NET
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DigitalData.EMLProfiler.clsWindream_allgemein.#ctor(DigitalData.Modules.Logging.LogConfig)">
|
||||
<summary>
|
||||
Konstruktor für die windream-Klasse
|
||||
|
||||
Reference in New Issue
Block a user