IMAP Biblios
This commit is contained in:
@@ -43,6 +43,9 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AE.Net.Mail, Version=1.7.10.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AE.Net.Mail.1.7.10.0\lib\net45\AE.Net.Mail.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
|
||||
BIN
App/DigitalData.EMLProfiler/bin/Debug/AE.Net.Mail.dll
Normal file
BIN
App/DigitalData.EMLProfiler/bin/Debug/AE.Net.Mail.dll
Normal file
Binary file not shown.
BIN
App/DigitalData.EMLProfiler/bin/Debug/AE.Net.Mail.pdb
Normal file
BIN
App/DigitalData.EMLProfiler/bin/Debug/AE.Net.Mail.pdb
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@ Imports Independentsoft.Email.Imap
|
||||
Imports Independentsoft.Email.Mime
|
||||
Imports DigitalData.EMLProfiler.ClassCurrent
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports AE
|
||||
Public Class clsEmailIMAP
|
||||
Private Shared Logger As DigitalData.Modules.Logging.Logger
|
||||
|
||||
@@ -16,12 +17,13 @@ Public Class clsEmailIMAP
|
||||
Try
|
||||
Logger.Info(String.Format("Working on IMAP_COLLECT....."))
|
||||
Logger.Debug(String.Format("Working on IMAP_COLLECT....."))
|
||||
Dim oClient As New ImapClient(MAIL_SERVER, MAIL_PORT)
|
||||
Dim oClient As New Independentsoft.Email.Imap.ImapClient(MAIL_SERVER, MAIL_PORT)
|
||||
|
||||
oClient.ValidateRemoteCertificate = False
|
||||
oClient.Connect()
|
||||
oClient.Login(MAIL_USER, MAIL_USER_PW)
|
||||
oClient.SelectFolder("Inbox")
|
||||
Dim oEnvelopes As Envelope() = oClient.ListMessages()
|
||||
Dim oEnvelopes As Independentsoft.Email.Imap.Envelope() = oClient.ListMessages()
|
||||
Dim oCount As Integer = 0
|
||||
For i As Integer = 0 To oEnvelopes.Length - 1
|
||||
If Not IsNothing(oEnvelopes(i).Subject) Then
|
||||
@@ -36,7 +38,7 @@ Public Class clsEmailIMAP
|
||||
End If
|
||||
Next
|
||||
oClient.Disconnect()
|
||||
Logger.Debug($"{oCOUNT.ToString} messages will be worked..")
|
||||
Logger.Debug($"{oCount.ToString} messages will be worked..")
|
||||
Logger.Debug("IMAP_COLLECT finished!")
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
@@ -47,24 +49,29 @@ Public Class clsEmailIMAP
|
||||
Public Function TEST_IMAP_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_IMAP_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 oImapClient As New ImapClient(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
' oImapClient.ValidateRemoteCertificate = False
|
||||
Dim oImapClient As New Independentsoft.Email.Imap.ImapClient(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
oImapClient.Logger = oindependentLogger
|
||||
oImapClient.ValidateRemoteCertificate = False
|
||||
oImapClient.Connect()
|
||||
Logger.Debug($"oImapClient connected...")
|
||||
Try
|
||||
oImapClient.Login(MAIL_USER, MAIL_USER_PW)
|
||||
oImapClient.Login(MAIL_USER, MAIL_USER_PW, AuthenticationType.Login)
|
||||
Catch ex As Exception
|
||||
MsgBox($"Unexpected error in TEST_IMAP_COLLECT (oImapClient.Login): {ex.Message}")
|
||||
Logger.Info($"Unexpected error in TEST_IMAP_COLLECT - User: [{MYMAIL_USER}] PW: [{MYMAIL_USER_PW}]")
|
||||
MsgBox($"Unexpected error in (oImapClient.Login): {ex.Message}")
|
||||
Logger.Info($"Unexpected error in oImapClient.Login - User: [{MYMAIL_USER}] PW: [{MYMAIL_USER_PW}]")
|
||||
Logger.Warn(ex.StackTrace.ToString)
|
||||
Logger.Warn(ex.Message)
|
||||
|
||||
oImapClient.Logger.Close()
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
oImapClient.SelectFolder(INBOXNAME)
|
||||
Dim oEnvelopes As Envelope() = oImapClient.ListMessages()
|
||||
Dim oEnvelopes As Independentsoft.Email.Imap.Envelope() = oImapClient.ListMessages()
|
||||
|
||||
For i As Integer = 0 To oEnvelopes.Length - 1
|
||||
If Not IsNothing(oEnvelopes(i).Subject) Then
|
||||
@@ -75,12 +82,54 @@ Public Class clsEmailIMAP
|
||||
Next
|
||||
|
||||
oImapClient.Disconnect()
|
||||
oImapClient.Logger.Close()
|
||||
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}]")
|
||||
MsgBox($"Unexpected error in TEST_IMAP_COLLECT: {ex.Message}")
|
||||
Logger.Error(ex, "Unexpected Error in TEST_IMAP_COLLECT:")
|
||||
|
||||
Return False
|
||||
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
|
||||
|
||||
@@ -60,21 +60,24 @@ Public Class clsEmail
|
||||
Public Function TEST_POP3_COLLECT(MYMAIL_SERVER As String, MYMAIL_PORT As Integer, MYMAIL_USER As String, MYMAIL_USER_PW As String) As Boolean
|
||||
Try
|
||||
Logger.Debug(String.Format("Working on TEST_POP3_COLLECT..."))
|
||||
Dim client As New Pop3Client(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
|
||||
client.ValidateRemoteCertificate = False
|
||||
client.Connect()
|
||||
Dim oPop3Client As New Pop3Client(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
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)
|
||||
' oPop3Client.ValidateRemoteCertificate = False
|
||||
oPop3Client.Logger = oindependentLogger
|
||||
oPop3Client.Connect()
|
||||
Logger.Debug(String.Format("..connected!"))
|
||||
client.Login(MYMAIL_USER, MYMAIL_USER_PW)
|
||||
oPop3Client.Login(MYMAIL_USER, MYMAIL_USER_PW)
|
||||
|
||||
Dim messageInfo As MessageInfo() = client.List()
|
||||
Dim messageInfo As MessageInfo() = oPop3Client.List()
|
||||
|
||||
For i As Integer = 0 To messageInfo.Length - 1
|
||||
Dim message As Message = client.GetMessage(messageInfo(i).Index)
|
||||
MsgBox(String.Format("Message [{0}] added", message.Subject))
|
||||
Dim message As Message = oPop3Client.GetMessage(messageInfo(i).Index)
|
||||
MsgBox($"Message-subject: {message.Subject}, Message unique ID = {messageInfo(i).UniqueID} added", )
|
||||
Next
|
||||
|
||||
client.Disconnect()
|
||||
oPop3Client.Disconnect()
|
||||
MsgBox(String.Format("TEST_POP3_COLLECT finished!"))
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
9c16fe2374e1e996b351d980c60514ee4e15bd53
|
||||
e16852c9dcabf8ca2116c0fea0baeab31771f4e2
|
||||
|
||||
@@ -17,7 +17,6 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\bin
|
||||
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\FirebirdSql.Data.FirebirdClient.pdb
|
||||
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.vbprojAssemblyReference.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
|
||||
@@ -25,3 +24,5 @@ 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.
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AE.Net.Mail" version="1.7.10.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.5.8" targetFramework="net461" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user