Vermerke
This commit is contained in:
@@ -8,6 +8,9 @@ Imports iTextSharp.text.pdf
|
||||
Imports Microsoft.Office.Interop
|
||||
Imports DocumentFormat.OpenXml.Presentation
|
||||
Imports SDL
|
||||
Imports System.IO
|
||||
Imports EAGetMail
|
||||
Imports System.Globalization
|
||||
|
||||
Public Class frmSendungsdetailsNEU
|
||||
Public AvisoId As Integer
|
||||
@@ -375,6 +378,7 @@ Public Class frmSendungsdetailsNEU
|
||||
|
||||
Private Sub frmSendungsdetails_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein._TRANSLATE(Me)
|
||||
Button23.Visible = True
|
||||
Try
|
||||
|
||||
Panel5.BackColor = VERAG_PROG_ALLGEMEIN.cAllgemein.cSPECIFIC.FIRMA_BgColor
|
||||
@@ -512,6 +516,7 @@ Public Class frmSendungsdetailsNEU
|
||||
frmGrayOut.Close()
|
||||
AVISO = AvisoDAL.LesenAviso(AvisoId, "")
|
||||
Else
|
||||
SAVE_ME()
|
||||
AvisoStatusFunctions.ummeldenAVISO(AVISO, it.Tag.ToString)
|
||||
End If
|
||||
Me.initDataBinding()
|
||||
@@ -3240,7 +3245,8 @@ Public Class frmSendungsdetailsNEU
|
||||
End Sub
|
||||
|
||||
Private Sub initVermerke()
|
||||
|
||||
RCntrlVermerke1.init(AVISO, SENDUNG_LIST(CURRENT_INDEX).tblSnd_SendungID)
|
||||
Exit Sub
|
||||
' If setAkive_AuswahlID() = -1 Then Exit Sub
|
||||
If AvisoId <= 0 Then Exit Sub
|
||||
|
||||
@@ -6668,6 +6674,7 @@ Public Class frmSendungsdetailsNEU
|
||||
End Sub
|
||||
|
||||
Private Sub btnLKWUmmelden_Click(sender As Object, e As EventArgs) Handles btnLKWUmmelden.Click
|
||||
|
||||
ContextMenuStrip3.Show(Cursor.Position)
|
||||
End Sub
|
||||
|
||||
@@ -6913,4 +6920,216 @@ Public Class frmSendungsdetailsNEU
|
||||
VALIDATE_ME(False)
|
||||
End Sub
|
||||
|
||||
Private Sub Button23_Click_1(sender As Object, e As EventArgs) Handles Button23.Click
|
||||
|
||||
With dgvMail
|
||||
.Rows.Clear()
|
||||
|
||||
Try
|
||||
' Create a folder named "inbox" under current directory
|
||||
' to save the email retrieved.
|
||||
'Dim localInbox As String = String.Format("{0}\inbox", Directory.GetCurrentDirectory())
|
||||
' MsgBox(localInbox)
|
||||
' If the folder is not existed, create it.
|
||||
' If Not Directory.Exists(localInbox) Then
|
||||
' Directory.CreateDirectory(localInbox)
|
||||
'End If
|
||||
|
||||
Dim oServer As New MailServer("owa.verag.ag",
|
||||
"al@verag.ag",
|
||||
"verag#2",
|
||||
ServerProtocol.Imap4)
|
||||
|
||||
' Enable SSL/TLS connection, most modern email server require SSL/TLS connection by default.
|
||||
oServer.SSLConnection = True
|
||||
oServer.Port = 993
|
||||
|
||||
' If your server doesn't support SSL/TLS connection, please use the following codes
|
||||
' oServer.SSLConnection = False
|
||||
' oServer.Port = 110
|
||||
|
||||
Console.WriteLine("Connecting server ...")
|
||||
|
||||
Dim oClient As New MailClient("EG-D1710817841-00027-8F73639A7EE1E54E-7E5AA3751E31F532")
|
||||
oClient.Connect(oServer)
|
||||
|
||||
|
||||
'Dim folders() As Imap4Folder = oClient.Imap4Folders
|
||||
'' enumerates all folders on IMAP4/Exchange server.
|
||||
'EnumerateFolder(folders)
|
||||
|
||||
Dim options As GetMailInfosOptionType = GetMailInfosOptionType.All
|
||||
options = options Or GetMailInfosOptionType.DateRange
|
||||
options = options Or GetMailInfosOptionType.OrderByDateTime
|
||||
options = options Or GetMailInfosOptionType.IncludeAllFolders
|
||||
|
||||
oClient.GetMailInfosParam.Reset()
|
||||
oClient.GetMailInfosParam.GetMailInfosOptions = options
|
||||
|
||||
oClient.GetMailInfosParam.SubjectContains = "EAGetMail Component"
|
||||
' oClient.GetMailInfosParam.UIDRange = "167355-167355"
|
||||
'oClient.GetMailInfosParam.BodyContains = "24DE770176692626M6"
|
||||
'oClient.GetMailInfosParam.SenderContains = "support"
|
||||
oClient.GetMailInfosParam.DateRange.SINCE = System.DateTime.Now.AddMonths(-12)
|
||||
oClient.GetMailInfosParam.DateRange.BEFORE = System.DateTime.Now.AddDays(1)
|
||||
oClient.GetMailInfosParam.DateRange.BEFORE = System.DateTime.Now.AddDays(1)
|
||||
|
||||
|
||||
Dim infos As MailInfo() = oClient.GetMailInfos()
|
||||
Console.WriteLine("Total {0} email(s)", infos.Length)
|
||||
|
||||
For i As Integer = 0 To infos.Length - 1
|
||||
Dim info As MailInfo = infos(i)
|
||||
Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}",
|
||||
info.Index, info.Size, info.UIDL)
|
||||
|
||||
' Retrieve email from IMAP server
|
||||
Dim oMail As Mail = oClient.GetMail(info)
|
||||
|
||||
Console.WriteLine("From: {0}", oMail.From.ToString())
|
||||
Console.WriteLine("Subject: {0}" & vbCr & vbLf, oMail.Subject)
|
||||
'?? oMail.MAPIConversationId.ToString
|
||||
.Rows.Add({oMail.From.ToString(), oMail.To.ToString(), oMail.Subject, oMail.Attachments.Count, info.UIDL})
|
||||
|
||||
' Generate an unqiue email file name based on date time.
|
||||
' Dim fileName As String = _generateFileName(i + 1)
|
||||
' Dim fullPath As String = String.Format("{0}\{1}", localInbox, fileName)
|
||||
|
||||
' Save email to local disk
|
||||
'oMail.SaveAs(fullPath, True)
|
||||
|
||||
' Mark email as deleted from POP3 server.
|
||||
'''''' oClient.Delete(info)
|
||||
|
||||
Next
|
||||
|
||||
' Quit and expunge emails marked as deleted from POP3 server.
|
||||
oClient.Quit()
|
||||
Console.WriteLine("Completed!")
|
||||
|
||||
Catch ep As Exception
|
||||
Console.WriteLine(ep.Message)
|
||||
Console.WriteLine(ep.StackTrace)
|
||||
MsgBox(ep.Message & " - " & ep.StackTrace)
|
||||
End Try
|
||||
|
||||
|
||||
End With
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
'Private Sub openMial(UIDL As String)
|
||||
|
||||
|
||||
|
||||
' Try
|
||||
' ' Create a folder named "inbox" under current directory
|
||||
' ' to save the email retrieved.
|
||||
' 'Dim localInbox As String = String.Format("{0}\inbox", Directory.GetCurrentDirectory())
|
||||
' ' MsgBox(localInbox)
|
||||
' ' If the folder is not existed, create it.
|
||||
' ' If Not Directory.Exists(localInbox) Then
|
||||
' ' Directory.CreateDirectory(localInbox)
|
||||
' 'End If
|
||||
|
||||
' Dim oServer As New MailServer("owa.verag.ag",
|
||||
' "al@verag.ag",
|
||||
' "verag#2",
|
||||
' ServerProtocol.Imap4)
|
||||
|
||||
' ' Enable SSL/TLS connection, most modern email server require SSL/TLS connection by default.
|
||||
' oServer.SSLConnection = True
|
||||
' oServer.Port = 993
|
||||
|
||||
' ' If your server doesn't support SSL/TLS connection, please use the following codes
|
||||
' ' oServer.SSLConnection = False
|
||||
' ' oServer.Port = 110
|
||||
|
||||
' Console.WriteLine("Connecting server ...")
|
||||
|
||||
' Dim oClient As New MailClient("EG-D1710817841-00027-8F73639A7EE1E54E-7E5AA3751E31F532")
|
||||
' oClient.Connect(oServer)
|
||||
|
||||
' Dim oUIDLManager As UIDLManager = New UIDLManager()
|
||||
' oUIDLManager.FindUIDL(oServer, UIDL)
|
||||
|
||||
' Dim fileName As String = _generateFileName(i + 1)
|
||||
' Dim fullPath As String = String.Format("{0}\{1}", localInbox, fileName)
|
||||
|
||||
' Console.WriteLine("Downloading {0}/{1} ...", i + 1, infos.Length)
|
||||
' Dim oMail As Mail = oClient.GetMail(info)
|
||||
|
||||
|
||||
' oClient.GetImap4FolderUID(,) = "UIDL"
|
||||
' 'oClient.GetMailInfosParam.BodyContains = "24DE770176692626M6"
|
||||
' 'oClient.GetMailInfosParam.SenderContains = "support"
|
||||
' oClient.GetMailInfosParam.DateRange.SINCE = System.DateTime.Now.AddMonths(-12)
|
||||
' oClient.GetMailInfosParam.DateRange.BEFORE = System.DateTime.Now.AddDays(1)
|
||||
' oClient.GetMailInfosParam.DateRange.BEFORE = System.DateTime.Now.AddDays(1)
|
||||
|
||||
|
||||
' Dim infos As MailInfo() = oClient.GetMailInfos(s)
|
||||
' Console.WriteLine("Total {0} email(s)", infos.Length)
|
||||
|
||||
' For i As Integer = 0 To infos.Length - 1
|
||||
' Dim info As MailInfo = infos(i)
|
||||
' Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}",
|
||||
' info.Index, info.Size, info.UIDL)
|
||||
|
||||
' ' Retrieve email from IMAP server
|
||||
' Dim oMail As Mail = oClient.GetMail(info)
|
||||
|
||||
' Console.WriteLine("From: {0}", oMail.From.ToString())
|
||||
' Console.WriteLine("Subject: {0}" & vbCr & vbLf, oMail.Subject)
|
||||
' '?? oMail.MAPIConversationId.ToString
|
||||
' .Rows.Add({oMail.From.ToString(), oMail.To.ToString(), oMail.Subject, oMail.Attachments.Count, info.UIDL})
|
||||
|
||||
' ' Generate an unqiue email file name based on date time.
|
||||
' ' Dim fileName As String = _generateFileName(i + 1)
|
||||
' ' Dim fullPath As String = String.Format("{0}\{1}", localInbox, fileName)
|
||||
|
||||
' ' Save email to local disk
|
||||
' 'oMail.SaveAs(fullPath, True)
|
||||
|
||||
' ' Mark email as deleted from POP3 server.
|
||||
' '''''' oClient.Delete(info)
|
||||
|
||||
' Next
|
||||
|
||||
' ' Quit and expunge emails marked as deleted from POP3 server.
|
||||
' oClient.Quit()
|
||||
' Console.WriteLine("Completed!")
|
||||
|
||||
' Catch ep As Exception
|
||||
' Console.WriteLine(ep.Message)
|
||||
' Console.WriteLine(ep.StackTrace)
|
||||
' MsgBox(ep.Message & " - " & ep.StackTrace)
|
||||
' End Try
|
||||
|
||||
|
||||
'End Sub
|
||||
|
||||
Public Sub EnumerateFolder(ByVal folders() As Imap4Folder)
|
||||
For i As Integer = 0 To folders.Length - 1
|
||||
Dim folder As Imap4Folder = folders(i)
|
||||
|
||||
Console.WriteLine("Name: {0}", folder.Name)
|
||||
Console.WriteLine("FullPath: {0}", folder.FullPath)
|
||||
Console.WriteLine("LocalPath: {0}", folder.LocalPath)
|
||||
Console.WriteLine("Flags: {0}", folder.IMAP4FolderFlags)
|
||||
Console.WriteLine("Subscribed: {0}" & vbCrLf, folder.Subscribed)
|
||||
|
||||
EnumerateFolder(folder.SubFolders)
|
||||
Next
|
||||
End Sub
|
||||
Function _generateFileName(ByVal sequence As Integer) As String
|
||||
Dim currentDateTime As DateTime = DateTime.Now
|
||||
Return String.Format("{0}-{1:000}-{2:000}.eml",
|
||||
currentDateTime.ToString("yyyyMMddHHmmss", New CultureInfo("en-US")),
|
||||
currentDateTime.Millisecond,
|
||||
sequence)
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user