MS
This commit is contained in:
parent
37693a8fc0
commit
fbb4d8ad2e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -146,11 +146,12 @@ Public Class clsEmailIMAP
|
|||||||
For oCounterEnvelope As Integer = 0 To oEnvelopes.Length - 1
|
For oCounterEnvelope As Integer = 0 To oEnvelopes.Length - 1
|
||||||
For oCounterUnseen As Integer = 0 To oUniqueID.Length - 1
|
For oCounterUnseen As Integer = 0 To oUniqueID.Length - 1
|
||||||
If oEnvelopes(oCounterEnvelope).UniqueID = oUniqueID(oCounterUnseen) Then
|
If oEnvelopes(oCounterEnvelope).UniqueID = oUniqueID(oCounterUnseen) Then
|
||||||
|
Dim oMSG = $"Working on unseen email: UniqueID [{oEnvelopes(oCounterEnvelope).UniqueID}] - Subject[{oEnvelopes(oCounterEnvelope).Subject}] - Date [{oEnvelopes(oCounterEnvelope).Date.ToString}]"
|
||||||
If IsTest = True Then
|
If IsTest = True Then
|
||||||
MsgBox($"Working on unseen email: UniqueID: {oEnvelopes(oCounterEnvelope).UniqueID} - Subject:{oEnvelopes(oCounterEnvelope).Subject} - Date {oEnvelopes(oCounterEnvelope).Date.ToString}")
|
MsgBox(oMSG)
|
||||||
End If
|
End If
|
||||||
Logger.Info($"Working on unseen email: UniqueID: {oEnvelopes(oCounterEnvelope).UniqueID} - Subject:{oEnvelopes(oCounterEnvelope).Subject} - Date {oEnvelopes(oCounterEnvelope).Date.ToString}")
|
Logger.Info(oMSG)
|
||||||
Logger.Debug($"Working on unseen email: UniqueID: {oEnvelopes(oCounterEnvelope).UniqueID} - Subject:{oEnvelopes(oCounterEnvelope).Subject} - Date {oEnvelopes(oCounterEnvelope).Date.ToString}")
|
Logger.Debug(oMSG)
|
||||||
Dim oMessage As Mime.Message = oClient.GetMessage(oEnvelopes(oCounterEnvelope).UniqueID)
|
Dim oMessage As Mime.Message = oClient.GetMessage(oEnvelopes(oCounterEnvelope).UniqueID)
|
||||||
If Not IsNothing(oMessage) Then
|
If Not IsNothing(oMessage) Then
|
||||||
oCount += 1
|
oCount += 1
|
||||||
@ -160,66 +161,6 @@ Public Class clsEmailIMAP
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
'For i As Integer = 0 To oUniqueID.Length - 1
|
|
||||||
' oFoundMessages(i) = oClient.GetMessage(oUniqueID(i))
|
|
||||||
' 'If oFoundMessages(i).Subject.ToLower.Contains("seen") Then
|
|
||||||
|
|
||||||
' For i1 As Integer = 0 To oEnvelopes.Length - 1
|
|
||||||
' If oEnvelopes(i1).UniqueID = oUniqueID(i) Then
|
|
||||||
' Logger.Info($"Working on unseen email: UniqueID: {oEnvelopes(i).UniqueID} - Subject:{oEnvelopes(i).Subject} - Date {oEnvelopes(i).Date.ToString}")
|
|
||||||
' Logger.Debug($"Working on unseen email: UniqueID: {oEnvelopes(i).UniqueID} - Subject:{oEnvelopes(i).Subject} - Date {oEnvelopes(i).Date.ToString}")
|
|
||||||
' Dim oMessage As Mime.Message = oClient.GetMessage(oEnvelopes(i).UniqueID)
|
|
||||||
' If Not IsNothing(oMessage) Then
|
|
||||||
' oCount += 1
|
|
||||||
' MAIL_LIST.Add(oMessage)
|
|
||||||
' oClient.Store(oEnvelopes(i1).UniqueID, "+FLAGS", "SEEN")
|
|
||||||
' End If
|
|
||||||
' End If
|
|
||||||
' Next
|
|
||||||
' 'End If
|
|
||||||
|
|
||||||
'Next
|
|
||||||
|
|
||||||
|
|
||||||
'Dim oEnvelopes As Independentsoft.Email.Imap.Envelope() = oClient.ListMessages()
|
|
||||||
'Dim oCount As Integer = 0
|
|
||||||
'For i As Integer = 0 To oEnvelopes.Length - 1
|
|
||||||
' If IsNothing(oEnvelopes(i).Subject) Then
|
|
||||||
' Logger.Debug("Attention...Subject is nothing!!")
|
|
||||||
' End If
|
|
||||||
' 'If envelopes(i).Subject.ToString.ToUpper.Contains("[PROCESSMANAGER]") Or envelopes(i).Subject.ToString.ToUpper.Contains("[ADDI]") Then
|
|
||||||
' Logger.Info($"Working on email: UniqueID: {oEnvelopes(i).UniqueID} - Subject:{oEnvelopes(i).Subject} - Date {oEnvelopes(i).Date.ToString}")
|
|
||||||
' Logger.Debug($"Working on email: UniqueID: {oEnvelopes(i).UniqueID} - Subject:{oEnvelopes(i).Subject} - Date {oEnvelopes(i).Date.ToString}")
|
|
||||||
|
|
||||||
|
|
||||||
' Dim oMessage As Mime.Message = oClient.GetMessage(oEnvelopes(i).UniqueID)
|
|
||||||
' If Not IsNothing(oMessage) Then
|
|
||||||
' oCount += 1
|
|
||||||
' MAIL_LIST.Add(oMessage)
|
|
||||||
' End If
|
|
||||||
' Try
|
|
||||||
' If DeleteinTest = True Then
|
|
||||||
' Logger.Debug($"Message shall be deleted...")
|
|
||||||
' oClient.Delete(oEnvelopes(i).UniqueID)
|
|
||||||
' Logger.Debug($"Message has been marked as deleted!")
|
|
||||||
' Else
|
|
||||||
' Logger.Debug("Message will be set to SEEN")
|
|
||||||
' oClient.Store(oEnvelopes(i).UniqueID, "-FLAGS", "SEEN")
|
|
||||||
' End If
|
|
||||||
' Catch ex As Exception
|
|
||||||
' Logger.Warn("Message could not be deleted: " & ex.Message)
|
|
||||||
' End Try
|
|
||||||
' Try
|
|
||||||
' If MoveMailTo <> "" Then
|
|
||||||
' Logger.Debug($"Moving to [{MoveMailTo}] is active...")
|
|
||||||
' oClient.AddMessage(MoveMailTo, oMessage)
|
|
||||||
' Logger.Debug($"Successfully moved!")
|
|
||||||
' End If
|
|
||||||
|
|
||||||
' Catch ex As Exception
|
|
||||||
' Logger.Warn("Message could not be moved: " & ex.Message)
|
|
||||||
' End Try
|
|
||||||
'Next
|
|
||||||
oClient.Expunge()
|
oClient.Expunge()
|
||||||
oClient.Disconnect()
|
oClient.Disconnect()
|
||||||
If oCount > 0 Then
|
If oCount > 0 Then
|
||||||
@ -323,54 +264,6 @@ Public Class clsEmailIMAP
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'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 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, AuthenticationType.Login)
|
|
||||||
' Catch ex As Exception
|
|
||||||
' 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 Independentsoft.Email.Imap.Envelope() = oImapClient.ListMessages()
|
|
||||||
|
|
||||||
' For i As Integer = 0 To oEnvelopes.Length - 1
|
|
||||||
' If Not IsNothing(oEnvelopes(i).Subject) Then
|
|
||||||
' 'If envelopes(i).Subject.ToString.ToUpper.Contains("[PROCESSMANAGER]") Or envelopes(i).Subject.ToString.ToUpper.Contains("[ADDI]") Then
|
|
||||||
' MsgBox($"Working on email: UniqueID: {oEnvelopes(i).UniqueID} - Subject:{oEnvelopes(i).Subject} - Date {oEnvelopes(i).Date.ToString}")
|
|
||||||
' Dim message As Mime.Message = oImapClient.GetMessage(oEnvelopes(i).UniqueID)
|
|
||||||
' End If
|
|
||||||
' 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
|
|
||||||
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -461,6 +461,11 @@ Public Class clsWorkEmail
|
|||||||
End If
|
End If
|
||||||
oMSGID = oMSGID.Replace(">", "").Replace("<", "")
|
oMSGID = oMSGID.Replace(">", "").Replace("<", "")
|
||||||
For Each oAttachment As Attachment In oCurrentMail.GetAttachments
|
For Each oAttachment As Attachment In oCurrentMail.GetAttachments
|
||||||
|
Dim oATTFilename = oAttachment.GetFileName.ToString.ToLower
|
||||||
|
If Not oATTFilename.EndsWith("pdf") Then
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
|
||||||
Dim oAttachmentFileString
|
Dim oAttachmentFileString
|
||||||
Logger.Debug(String.Format(" Working on Attachment [{0}]", oAttachment.GetFileName))
|
Logger.Debug(String.Format(" Working on Attachment [{0}]", oAttachment.GetFileName))
|
||||||
Try
|
Try
|
||||||
@ -471,6 +476,7 @@ Public Class clsWorkEmail
|
|||||||
End If
|
End If
|
||||||
oAttachmentFileString = Path.Combine(PATH_TEMP, $"{oMSGID}~{oFilename}")
|
oAttachmentFileString = Path.Combine(PATH_TEMP, $"{oMSGID}~{oFilename}")
|
||||||
|
|
||||||
|
|
||||||
If System.IO.File.Exists(oAttachmentFileString) = False Then
|
If System.IO.File.Exists(oAttachmentFileString) = False Then
|
||||||
Logger.Debug(String.Format("Trying to save attachment [{0}]", oAttachmentFileString))
|
Logger.Debug(String.Format("Trying to save attachment [{0}]", oAttachmentFileString))
|
||||||
oAttachment.Save(oAttachmentFileString)
|
oAttachment.Save(oAttachmentFileString)
|
||||||
|
|||||||
@ -134,10 +134,13 @@ Public Class clsWorker
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If pollresult = False Then
|
If pollresult = False Then
|
||||||
Logger.Warn(String.Format("Error while polling emails...."))
|
Logger.Warn(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("S22 also returned error!"))
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
If MAIL_LIST.Count() > 0 Then
|
If MAIL_LIST.Count() > 0 Then
|
||||||
Logger.Info(String.Format("Worked/Pulled: {0} E-Mails", MAIL_LIST.Count()))
|
Logger.Info(String.Format("Worked/Pulled: {0} E-Mails", MAIL_LIST.Count()))
|
||||||
For Each pulled_msg As Message In MAIL_LIST
|
For Each pulled_msg As Message In MAIL_LIST
|
||||||
If _workmail.WORK_MAIL(pulled_msg) = True Then
|
If _workmail.WORK_MAIL(pulled_msg) = True Then
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -28,3 +28,4 @@ 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.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.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\obj\Debug\DigitalData.EMLProfiler.pdb
|
||||||
|
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.vbprojAssemblyReference.cache
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user