MONSTER: Rename Monorepo to Modules, only keep Projects under Modules.*
This commit is contained in:
559
Messaging/Email.vb
Normal file
559
Messaging/Email.vb
Normal file
@@ -0,0 +1,559 @@
|
||||
Imports Independentsoft.Email
|
||||
Imports Independentsoft.Email.Pop3
|
||||
Imports Independentsoft.Email.Mime
|
||||
Imports Independentsoft.Email.Imap
|
||||
Imports System.Net.Mail
|
||||
Imports System.Net
|
||||
Imports System.Reflection
|
||||
Imports System.IO
|
||||
|
||||
Public Class Email
|
||||
Private ReadOnly _logger As Logging.Logger
|
||||
Private ReadOnly _logConfig As Logging.LogConfig
|
||||
Public Err_Message As String
|
||||
Public _msg_Send As Boolean
|
||||
|
||||
Public Sub New(LogConfig As Logging.LogConfig)
|
||||
_logger = LogConfig.GetLogger()
|
||||
_logConfig = LogConfig
|
||||
End Sub
|
||||
|
||||
'''' <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>
|
||||
'Public Function TestIMAPLogin(Server As String, Port As Integer, Username As String, Password As String, Optional Folder As String = "Inbox") 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")
|
||||
|
||||
' _logger.Debug("Fetching MessageIds..")
|
||||
' Dim oMessageIds As IEnumerable(Of UInteger) = oClient.Search(S22.Imap.SearchCondition.Unseen, Folder)
|
||||
|
||||
' _logger.Debug("Found {0} messages", oMessageIds.Count)
|
||||
' _logger.Debug("Fetching messages...")
|
||||
|
||||
' Dim oMessages As IEnumerable(Of MailMessage) = oClient.GetMessages(oMessageIds, False, Folder)
|
||||
' _logger.Debug("Messages fetched")
|
||||
|
||||
' oClient.Dispose()
|
||||
|
||||
' Return True
|
||||
' End Using
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
'''' <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>
|
||||
'Public Function FetchIMAPMessages(Server As String, Port As Integer, Username As String, Password As String, Folder As String) As List(Of Message) ', Optional SearchCondition As S22.Imap.SearchCondition = S22.Imap.SearchCondition.All
|
||||
' Dim oMessages As New List(Of Message)
|
||||
|
||||
' _logger.Debug("Connecting 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 Nothing
|
||||
' End If
|
||||
' _logger.Debug("Connection successful")
|
||||
|
||||
' _logger.Debug("Fetching MessageIds..")
|
||||
' Dim oMessageIds As IEnumerable(Of UInteger) = oClient.Search(S22.Imap.SearchCondition.Unseen, Folder)
|
||||
|
||||
' _logger.Debug("Found {0} messages", oMessageIds.Count)
|
||||
' _logger.Debug("Fetching messages...")
|
||||
|
||||
' ' Since this needs to return a list of IndependentSoft Message objects,
|
||||
' ' we 'convert' the .NET MailMessage objects that are fetched from the server
|
||||
' ' by writing them temporarily to disk as an eml file and then reading them back into a Message object.
|
||||
' ' This approach uses an unintended use of internal .NET APIs and may break in the future.
|
||||
' For Each oMessageId As UInteger In oMessageIds
|
||||
' Dim oMessage = oClient.GetMessage(oMessageId, False, Folder)
|
||||
' Dim oTempPath = Path.GetTempFileName()
|
||||
' Dim oResult = WriteMessageToFile(oMessage, oTempPath)
|
||||
|
||||
' Dim oMsg As New Message(oTempPath)
|
||||
' oMessages.Add(oMsg)
|
||||
|
||||
' Try
|
||||
' File.Delete(oTempPath)
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' _logger.Warn("Temp file could not be deleted")
|
||||
' End Try
|
||||
' Next
|
||||
|
||||
' _logger.Debug("{0} Messages fetched", oMessages.Count)
|
||||
' End Using
|
||||
|
||||
' Return oMessages
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Return Nothing
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
''' <summary>
|
||||
''' Uses a private API from MailWriter to write a MailMessage to disk.
|
||||
''' May break in future versions of .NET
|
||||
''' </summary>
|
||||
Public Function WriteMessageToFile(Message As MailMessage, Filename As String) As Boolean
|
||||
Dim oAssembly As Assembly = GetType(System.Net.Mail.SmtpClient).Assembly
|
||||
Dim oMailWriterType As Type = oAssembly.[GetType]("System.Net.Mail.MailWriter")
|
||||
|
||||
Try
|
||||
Using oStream As New FileStream(Filename, FileMode.Create)
|
||||
Dim oMailWriterConstructor As ConstructorInfo = oMailWriterType.GetConstructor(
|
||||
BindingFlags.Instance Or BindingFlags.NonPublic, Nothing, New Type() {GetType(Stream)}, Nothing
|
||||
)
|
||||
Dim oMailWriter As Object = oMailWriterConstructor.Invoke(New Object() {oStream})
|
||||
Dim sendMethod As MethodInfo = GetType(MailMessage).GetMethod("Send", BindingFlags.Instance Or BindingFlags.NonPublic)
|
||||
sendMethod.Invoke(Message, BindingFlags.Instance Or BindingFlags.NonPublic, Nothing, {oMailWriter, True, True}, Nothing)
|
||||
End Using
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'Public Function IMAP_COLLECT(INBOXNAME As String, MYMAIL_SERVER As String, MYMAIL_PORT As Integer, MYMAIL_USER As String, MYMAIL_USER_PW As String)
|
||||
' Try
|
||||
' Dim oMAIL_LIST As New ArrayList()
|
||||
' _logger.Info(String.Format("Working on IMAP_COLLECT..."))
|
||||
' Dim oClient As New ImapClient(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
' oClient.Connect()
|
||||
' oClient.Login(MYMAIL_USER, MYMAIL_USER_PW)
|
||||
' oClient.SelectFolder("Inbox")
|
||||
' Dim oEnvelopes As Envelope() = oClient.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
|
||||
' _logger.Info($"Working on email: UniqueID: {oEnvelopes(i).UniqueID} - Subject:{oEnvelopes(i).Subject} - Date {oEnvelopes(i).Date.ToString}")
|
||||
' Dim message As Mime.Message = oClient.GetMessage(oEnvelopes(i).UniqueID)
|
||||
' If Not IsNothing(message) Then
|
||||
' oMAIL_LIST.Add(message)
|
||||
' End If
|
||||
' 'End If
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' oClient.Disconnect()
|
||||
' _logger.Debug("IMAP_COLLECT finished!")
|
||||
' Return oMAIL_LIST
|
||||
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex, "Unexpected Error in IMAP COLLECT:")
|
||||
' Return Nothing
|
||||
' End Try
|
||||
'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 oClient As New ImapClient(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
' oClient.Connect()
|
||||
' oClient.Login(MYMAIL_USER, MYMAIL_USER_PW)
|
||||
' oClient.SelectFolder(INBOXNAME)
|
||||
' Dim oEnvelopes As Envelope() = oClient.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 = oClient.GetMessage(oEnvelopes(i).UniqueID)
|
||||
' End If
|
||||
' Next
|
||||
' oClient.Disconnect()
|
||||
' _logger.Info("TEST_IMAP_COLLECT finished!")
|
||||
' Return True
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex, "Unexpected Error in TEST_IMAP_COLLECT:")
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
'Public Function POP3_COLLECT(MYMAIL_SERVER As String, MYMAIL_PORT As Integer, MYMAIL_USER As String, MYMAIL_USER_PW As String)
|
||||
' Try
|
||||
' Dim oMAIL_LIST As New ArrayList()
|
||||
' _logger.Debug(String.Format("Working on POP3_COLLECT....."))
|
||||
' Dim oClient As New Pop3Client(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
|
||||
' oClient.ValidateRemoteCertificate = False
|
||||
' oClient.Connect()
|
||||
' _logger.Debug(String.Format("..connected!"))
|
||||
' oClient.Login(MYMAIL_USER, MYMAIL_USER_PW)
|
||||
|
||||
' Dim oMessageInfo As MessageInfo() = oClient.List()
|
||||
|
||||
' For i As Integer = 0 To oMessageInfo.Length - 1
|
||||
' Dim message As Message = oClient.GetMessage(oMessageInfo(i).Index)
|
||||
' oMAIL_LIST.Add(message)
|
||||
' Try
|
||||
' _logger.Debug(String.Format("Message [{0}] added", message.Subject))
|
||||
' Catch ex As Exception
|
||||
|
||||
' End Try
|
||||
' Next
|
||||
|
||||
' oClient.Disconnect()
|
||||
' _logger.Debug(String.Format(" POP3_COLLECT finished!"))
|
||||
' Return oMAIL_LIST
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
|
||||
' Return Nothing
|
||||
' End Try
|
||||
'End Function
|
||||
'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 oClient As New Pop3Client(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
|
||||
' oClient.ValidateRemoteCertificate = False
|
||||
' oClient.Connect()
|
||||
' _logger.Debug(String.Format("..connected!"))
|
||||
' oClient.Login(MYMAIL_USER, MYMAIL_USER_PW)
|
||||
|
||||
' Dim messageInfo As MessageInfo() = oClient.List()
|
||||
|
||||
' For i As Integer = 0 To messageInfo.Length - 1
|
||||
' Dim message As Message = oClient.GetMessage(messageInfo(i).Index)
|
||||
' MsgBox(String.Format("Message [{0}] added", message.Subject))
|
||||
|
||||
' Next
|
||||
|
||||
' oClient.Disconnect()
|
||||
' MsgBox(String.Format("TEST_POP3_COLLECT finished!"))
|
||||
' Return True
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
Public Function NewEmail(mailto As String, mailSubject As String, mailBody As String,
|
||||
mailfrom As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String,
|
||||
AUTH_TYPE As String, SENDER_INSTANCE As String, Optional attachmentString As String = "", Optional Test As Boolean = False)
|
||||
Dim myClient As Net.Mail.SmtpClient
|
||||
Dim myMesssage As New MailMessage
|
||||
|
||||
Try
|
||||
Dim oError As Boolean = False
|
||||
Dim oReceipiants As String()
|
||||
If mailto.Contains(";") Then
|
||||
oReceipiants = mailto.Split(";")
|
||||
Else
|
||||
ReDim Preserve oReceipiants(0)
|
||||
oReceipiants(0) = mailto
|
||||
End If
|
||||
For Each oMailReceipiant As String In oReceipiants
|
||||
_logger.Debug($"oMailReceipiant [{oMailReceipiant}]")
|
||||
_logger.Debug($"mailsmtp [{mailsmtp}]")
|
||||
|
||||
Try
|
||||
myClient = New Net.Mail.SmtpClient(mailsmtp, mailport)
|
||||
Catch ex As Exception
|
||||
_logger.Warn($"Could not create SMTP-Client: [{ex.Message}]")
|
||||
Return False
|
||||
End Try
|
||||
myClient.DeliveryMethod = SmtpDeliveryMethod.Network
|
||||
|
||||
myClient.Port = mailport
|
||||
_logger.Debug($"mailport [{mailport}]")
|
||||
If AUTH_TYPE = "SSL" Then
|
||||
_logger.Debug("SSL = true")
|
||||
myClient.EnableSsl = True
|
||||
Else
|
||||
_logger.Debug("SSL = false")
|
||||
myClient.EnableSsl = False
|
||||
End If
|
||||
_logger.Debug($"mailUser [{mailUser}]")
|
||||
myClient.Credentials = New NetworkCredential(mailUser, mailPW)
|
||||
myClient.UseDefaultCredentials = False
|
||||
|
||||
If Test = True Then
|
||||
myMesssage.Body = $"This is the body (text will be replaced within profile)! <br> mailsmtp: {mailsmtp} <br> mailport: {mailport} <br> mailUser: {mailUser} <br> mailPW: XXXX <br> AUTH_TYPE: {AUTH_TYPE}"
|
||||
Else
|
||||
myMesssage.Body = mailBody
|
||||
End If
|
||||
_logger.Debug($"mailBody [{mailBody}]")
|
||||
'mymesssage.IsBodyHtml = True
|
||||
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(myMesssage.Body)
|
||||
htmlView.ContentType = New System.Net.Mime.ContentType("text/html")
|
||||
myMesssage.AlternateViews.Add(htmlView)
|
||||
_logger.Debug($"attachmentString [{attachmentString}]")
|
||||
If attachmentString <> "" Then
|
||||
_logger.Info($"Attachment Path is: {attachmentString}")
|
||||
Dim oAttachment As New System.Net.Mail.Attachment(attachmentString)
|
||||
|
||||
'If attment.ToLower.EndsWith("pdf") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "pdf")
|
||||
'ElseIf attment.ToLower.EndsWith("jpg") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "jpg")
|
||||
'ElseIf attment.ToLower.EndsWith("docx") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "MS-word")
|
||||
'End If
|
||||
myMesssage.Attachments.Add(oAttachment)
|
||||
Else
|
||||
_logger.Debug("No Attachment.")
|
||||
End If
|
||||
_logger.Debug($"mailfrom [{mailfrom}]")
|
||||
|
||||
myMesssage.From = New MailAddress(mailfrom)
|
||||
_logger.Debug($"mailSubject [{mailSubject}]")
|
||||
myMesssage.Subject = mailSubject
|
||||
myMesssage.To.Add(New MailAddress(oMailReceipiant))
|
||||
_logger.Debug($"Now Sending mail...")
|
||||
myClient.Send(myMesssage)
|
||||
_logger.Debug($"Mail has been sent!")
|
||||
_logger.Info("Message to " & oMailReceipiant & " has been send.")
|
||||
Next
|
||||
If oError = False Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Try
|
||||
_logger.Info("Unexpected error in Sending smtp-Mail: ")
|
||||
If Not IsNothing(myClient) Then
|
||||
_logger.Info($"myClient.Host: {myClient.Host.ToString}")
|
||||
_logger.Info($"myClient.Port: {myClient.Port.ToString}")
|
||||
_logger.Info($"myClient.EnableSsl: {myClient.EnableSsl.ToString}")
|
||||
|
||||
End If
|
||||
If Not IsNothing(myMesssage) Then
|
||||
_logger.Info($"myMesssage.Subject: {myMesssage.Subject.ToString}")
|
||||
_logger.Info($"myMesssage.Body: {myMesssage.Body.ToString}")
|
||||
_logger.Info($"myMesssage.From: {myMesssage.From.ToString}")
|
||||
End If
|
||||
Catch e1x As Exception
|
||||
|
||||
End Try
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
'Public Function New_EmailISoft(ByVal mailSubject As String, ByVal mailBody As String, mailto As String,
|
||||
' from_mailaddress As String, from_name As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String,
|
||||
' AUTH_TYPE As String, SENDER_INSTANCE As String, Optional attment As String = "")
|
||||
' Try
|
||||
' Err_Message = ""
|
||||
' _msg_Send = False
|
||||
' ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
|
||||
' _logger.Debug($"in Email_Send_Independentsoft..")
|
||||
' Dim empfaenger As String()
|
||||
' If mailto.Contains(";") Then
|
||||
' empfaenger = mailto.Split(";")
|
||||
' Else
|
||||
' ReDim Preserve empfaenger(0)
|
||||
' empfaenger(0) = mailto
|
||||
' End If
|
||||
' Dim _error As Boolean = False
|
||||
' 'Für jeden Empfänger eine Neue Mail erzeugen
|
||||
' For Each _mailempfaenger As String In empfaenger
|
||||
' _logger.Debug($"Working on email for {_mailempfaenger}..")
|
||||
' Try
|
||||
' Dim oMessage As New Message()
|
||||
' oMessage.From = New Mailbox(from_mailaddress, from_name)
|
||||
|
||||
' oMessage.[To].Add(New Mailbox(_mailempfaenger))
|
||||
' oMessage.Subject = mailSubject
|
||||
' _logger.Debug($"Message created..")
|
||||
' Dim textBodyPart As New BodyPart()
|
||||
' textBodyPart.ContentType = New ContentType("text", "html", "utf-8")
|
||||
' textBodyPart.ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable
|
||||
' textBodyPart.Body = mailBody
|
||||
' oMessage.BodyParts.Add(textBodyPart)
|
||||
' If attment <> String.Empty Then
|
||||
' If System.IO.File.Exists(attment) Then
|
||||
' Dim attachment1 As New Independentsoft.Email.Mime.Attachment(attment)
|
||||
' If attment.ToLower.EndsWith("pdf") Then
|
||||
' attachment1.ContentType = New ContentType("application", "pdf")
|
||||
' ElseIf attment.ToLower.EndsWith("jpg") Then
|
||||
' attachment1.ContentType = New ContentType("application", "jpg")
|
||||
' ElseIf attment.ToLower.EndsWith("docx") Then
|
||||
' attachment1.ContentType = New ContentType("application", "MS-word")
|
||||
' End If
|
||||
' oMessage.BodyParts.Add(attachment1)
|
||||
' Else
|
||||
' _logger.Warn($"Attachment {attment.ToString} is not existing!")
|
||||
' End If
|
||||
' End If
|
||||
' Dim client As Independentsoft.Email.Smtp.SmtpClient
|
||||
' Try
|
||||
' client = New Independentsoft.Email.Smtp.SmtpClient(mailsmtp, mailport)
|
||||
' Catch ex As Exception
|
||||
' _logger.Warn("clsEmail.Create Client: " & ex.Message)
|
||||
' _error = True
|
||||
' Continue For
|
||||
' End Try
|
||||
' Try
|
||||
' client.Connect()
|
||||
' Catch ex As Exception
|
||||
' _logger.Warn("clsEmail.Client.Connect1: " & ex.Message)
|
||||
' _logger.Debug("Error in ClientConnect - but still trying to send")
|
||||
' _error = True
|
||||
' ' Continue For
|
||||
' End Try
|
||||
' _logger.Debug("Connected to Client!")
|
||||
' If AUTH_TYPE = "SSL" Then
|
||||
' client.EnableSsl = True
|
||||
' 'client.ValidateRemoteCertificate = True
|
||||
' _logger.Debug("Authentification via SSL.")
|
||||
' ElseIf AUTH_TYPE = "TLS" Then
|
||||
' ' client.ValidateRemoteCertificate = False
|
||||
' client.StartTls()
|
||||
' client.EnableSsl = False
|
||||
' _logger.Debug("Authentification via TLS. SSL disabled")
|
||||
' Else
|
||||
' client.EnableSsl = False
|
||||
' _logger.Debug("Authentification NONE. SSL disabled")
|
||||
' End If
|
||||
' Try
|
||||
|
||||
' client.Connect()
|
||||
' Catch ex As Exception
|
||||
' _logger.Warn("clsEmail.Client.Connect: " & ex.Message)
|
||||
' Err_Message = "clsEmail.Client.Connect: " & ex.Message
|
||||
' _error = True
|
||||
' ' Continue For
|
||||
' End Try
|
||||
' Try
|
||||
' If mailsmtp.Contains("office365.com") Then
|
||||
' client.Login(mailUser, mailPW, AuthenticationType.None)
|
||||
' Else
|
||||
' client.Login(mailUser, mailPW)
|
||||
' End If
|
||||
|
||||
' _logger.Debug("Logged in!")
|
||||
' Catch ex As Exception
|
||||
' Try
|
||||
' If mailsmtp.Contains("office365.com") Then
|
||||
' client.Login(mailUser, mailPW, AuthenticationType.Login)
|
||||
' Else
|
||||
' client.Login(mailUser, mailPW, AuthenticationType.Anonymous)
|
||||
' End If
|
||||
|
||||
' Catch ex1 As Exception
|
||||
' Try
|
||||
' client.Login(mailUser, mailPW, AuthenticationType.Login)
|
||||
' Catch ex2 As Exception
|
||||
' _logger.Warn("clsEmail.Client.Login: " & ex.Message)
|
||||
' _error = True
|
||||
' client.Disconnect()
|
||||
' Continue For
|
||||
' End Try
|
||||
' End Try
|
||||
' End Try
|
||||
' Try
|
||||
' client.Send(oMessage)
|
||||
' _logger.Info("Message to " & _mailempfaenger & " has been send.")
|
||||
' _msg_Send = True
|
||||
' _error = False
|
||||
' Catch ex As Exception
|
||||
' _logger.Warn("clsEmail.Client.Send: " & ex.Message)
|
||||
' Err_Message = ex.Message
|
||||
' _error = True
|
||||
' client.Disconnect()
|
||||
' Continue For
|
||||
' End Try
|
||||
' client.Disconnect()
|
||||
|
||||
' Catch ex As Exception
|
||||
' Err_Message = ex.Message
|
||||
' If _msg_Send = True Then
|
||||
' _logger.Info($"Error Closing Connection [{ex.Message}]")
|
||||
' Else
|
||||
' _logger.Error(ex)
|
||||
' End If
|
||||
' _error = True
|
||||
' End Try
|
||||
' Next
|
||||
|
||||
' If _error = True Then
|
||||
' Return False
|
||||
' Else
|
||||
' Return True
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Err_Message = ex.Message
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
'Public Function DELETE_EMAIL(POLLTYPE As String, msgid As String, MYMAIL_SERVER As String, MYMAIL_PORT As Integer, MYMAIL_USER As String, MYMAIL_USER_PW As String)
|
||||
' Try
|
||||
' If POLLTYPE = "POP" Then
|
||||
' Dim oClient As New Pop3Client(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
|
||||
' oClient.ValidateRemoteCertificate = False
|
||||
' oClient.Connect()
|
||||
' oClient.Login(MYMAIL_USER, MYMAIL_USER_PW)
|
||||
|
||||
' Dim oMessageInfo As MessageInfo() = oClient.List()
|
||||
|
||||
' For i As Integer = 0 To oMessageInfo.Length - 1
|
||||
' Dim message As Message = oClient.GetMessage(oMessageInfo(i).Index)
|
||||
' If message.MessageID = msgid Then
|
||||
' oClient.Delete(oMessageInfo(i).Index)
|
||||
' _logger.Info(String.Format("Message [{0}] was deleted!", message.Subject))
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
' oClient.Disconnect()
|
||||
' Return True
|
||||
' ElseIf POLLTYPE = "IMAP" Then
|
||||
' Dim oIMAPClient As New ImapClient(MYMAIL_SERVER, MYMAIL_PORT)
|
||||
|
||||
' oIMAPClient.ValidateRemoteCertificate = False
|
||||
' oIMAPClient.Connect()
|
||||
' oIMAPClient.Login(MYMAIL_USER, MYMAIL_USER_PW)
|
||||
|
||||
' oIMAPClient.SelectFolder("Inbox")
|
||||
' Dim envelopes As Envelope() = oIMAPClient.ListMessages()
|
||||
' For i As Integer = 0 To envelopes.Length - 1
|
||||
' If envelopes(i).MessageID = msgid Then
|
||||
' oIMAPClient.Delete(envelopes(i).UniqueID) 'mark as deleted
|
||||
' End If
|
||||
' Next
|
||||
' oIMAPClient.Expunge() 'delete messages marked as deleted
|
||||
' oIMAPClient.Disconnect()
|
||||
' Return True
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' 'clsLogger.Add("Unexpected Error in DELETE_EMAIL: " & ex.Message)
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
End Class
|
||||
483
Messaging/Email2.vb
Normal file
483
Messaging/Email2.vb
Normal file
@@ -0,0 +1,483 @@
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports Limilabs.Mail
|
||||
Imports Limilabs.Mail.MIME
|
||||
Imports Limilabs.Mail.MSG
|
||||
Imports Limilabs.Client.IMAP
|
||||
Imports Limilabs.Client.SMTP
|
||||
Imports Limilabs.Client
|
||||
|
||||
Public Class Email2
|
||||
Private ReadOnly Logger As Logger
|
||||
Private ReadOnly LoggerMail As Logger
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
Private ReadOnly FileEx As Filesystem.File
|
||||
Private ReadOnly MailBuilder As New MailBuilder()
|
||||
Private ReadOnly TempFiles As New List(Of String)
|
||||
|
||||
Private DisableExcessiveLogging As Boolean = False
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
LogConfig = pLogConfig
|
||||
Logger = pLogConfig.GetLogger()
|
||||
LoggerMail = pLogConfig.GetLogger("Limilabs.Mail")
|
||||
FileEx = New Filesystem.File(pLogConfig)
|
||||
|
||||
' Turn on internal Mail.dll logging
|
||||
Limilabs.Mail.Log.Enabled = True
|
||||
|
||||
AddHandler Limilabs.Mail.Log.WriteLine, AddressOf ProcessMailLog
|
||||
End Sub
|
||||
|
||||
Public Enum EmailSecurity
|
||||
SSL
|
||||
START_TLS
|
||||
End Enum
|
||||
|
||||
Private Sub ProcessMailLog(pMessage As String)
|
||||
If DisableExcessiveLogging = False Then
|
||||
LoggerMail.Debug(pMessage)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function New_SMTPConnection(pSMTP As Smtp, pServer As String, pUsername As String, pPassword As String, pSecurity As EmailSecurity, Optional pPort As Integer = 0) As Smtp
|
||||
Try
|
||||
Logger.Info("Connecting to SMTP server [{0}:{1}] with user [{2}]", pServer, pPort, pUsername)
|
||||
|
||||
Dim oPort As Integer
|
||||
If pPort = 0 Then
|
||||
If pSecurity = EmailSecurity.SSL Then
|
||||
oPort = Smtp.DefaultSSLPort
|
||||
|
||||
Else
|
||||
oPort = Smtp.DefaultPort
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
oPort = pPort
|
||||
|
||||
End If
|
||||
Logger.Debug("Using Port [{0}] for connection", oPort)
|
||||
|
||||
If pSecurity = EmailSecurity.SSL Then
|
||||
Logger.Debug("Using SSL/TLS as Security Option")
|
||||
pSMTP.ConnectSSL(pServer, oPort)
|
||||
Else
|
||||
Logger.Debug("Using STARTTLS as Security Option")
|
||||
pSMTP.Connect(pServer, oPort)
|
||||
pSMTP.StartTLS()
|
||||
End If
|
||||
Logger.Debug("Connection to SMTP Server [{0}] established!", pServer)
|
||||
|
||||
Logger.Debug("Logging in with user [{0}]", pUsername)
|
||||
pSMTP.UseBestLogin(pUsername, pPassword)
|
||||
|
||||
Return pSMTP
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Could not connect to server [{0}] with user [{1}]", pServer, pUsername)
|
||||
Logger.Error(ex)
|
||||
Return pSMTP
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function New_IMAPConnection(pServer As String, pUsername As String, pPassword As String, pSecurity As EmailSecurity, Optional pPort As Integer = 0) As Imap
|
||||
Try
|
||||
Logger.Info("Connecting to IMAP server [{0}:{1}] with user [{2}]", pServer, pPort, pUsername)
|
||||
|
||||
Dim oIMAP As New Imap()
|
||||
Dim oPort As Integer
|
||||
If pPort = 0 Then
|
||||
If pSecurity = EmailSecurity.SSL Then
|
||||
oPort = Imap.DefaultSSLPort
|
||||
|
||||
Else
|
||||
oPort = Imap.DefaultPort
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
oPort = pPort
|
||||
|
||||
End If
|
||||
Logger.Debug("Using Port [{0}] for connection", oPort)
|
||||
|
||||
If pSecurity = EmailSecurity.SSL Then
|
||||
Logger.Debug("Using SSL/TLS as Security Option")
|
||||
oIMAP.ConnectSSL(pServer, oPort)
|
||||
Else
|
||||
Logger.Debug("Using STARTTLS as Security Option")
|
||||
oIMAP.Connect(pServer, oPort)
|
||||
oIMAP.StartTLS()
|
||||
End If
|
||||
Logger.Debug("Connection to IMAP Server [{0}] established!", pServer)
|
||||
|
||||
Logger.Debug("Logging in with user [{0}]", pUsername)
|
||||
oIMAP.UseBestLogin(pUsername, pPassword)
|
||||
|
||||
Return oIMAP
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Could not connect to server [{0}] with user [{1}]", pServer, pUsername)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Test_IMAPLogin(pClient As Imap, Optional pFolder As String = "Inbox") As Boolean
|
||||
Logger.Info("Testing Login to IMAP Server")
|
||||
|
||||
Try
|
||||
Logger.Debug("Fetching Inbox")
|
||||
Dim oStatus As FolderStatus = pClient.SelectInbox()
|
||||
|
||||
Logger.Debug("Test succeeded!")
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Login failed for IMAP server!")
|
||||
Logger.Error(ex)
|
||||
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Test_SMTPLogin(pClient As Smtp) As Boolean
|
||||
Logger.Info("Testing Login to IMAP Server")
|
||||
|
||||
Try
|
||||
Dim oExtensions = pClient.SupportedExtensions()
|
||||
Dim oExtensionArray = oExtensions.Select(Function(ex) ex.ToString).ToArray
|
||||
Logger.Debug("Supported Extensions: ")
|
||||
Logger.Debug(String.Join(", ", oExtensionArray))
|
||||
Logger.Debug("Test succeeded!")
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Login failed for SMTP server!")
|
||||
Logger.Error(ex)
|
||||
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Get_IMAPMessages(pClient As Imap, Optional pFolder As String = "Inbox") As List(Of IMail)
|
||||
Logger.Info("Fetching Messages in Folder [{0}]", pFolder)
|
||||
Dim oMails As New List(Of IMail)
|
||||
|
||||
Try
|
||||
Logger.Debug("Fetching Folder [{0}]", pFolder)
|
||||
Dim oStatus As FolderStatus = pClient.Select(pFolder)
|
||||
|
||||
Logger.Debug("Fetching Unseen UUIDs")
|
||||
|
||||
DisableExcessiveLogging = True
|
||||
Dim oUUIDs As List(Of Long) = pClient.Search(Flag.Unseen)
|
||||
DisableExcessiveLogging = False
|
||||
|
||||
Logger.Debug("Fetching Unseen Mails")
|
||||
For Each oUUID As Long In oUUIDs
|
||||
DisableExcessiveLogging = True
|
||||
Dim oEmlFile As Byte() = pClient.GetMessageByUID(oUUID)
|
||||
DisableExcessiveLogging = False
|
||||
|
||||
Dim oEmail As IMail = MailBuilder.CreateFromEml(oEmlFile)
|
||||
oMails.Add(oEmail)
|
||||
|
||||
Next
|
||||
|
||||
Logger.Debug("Emails fetched!")
|
||||
|
||||
Return oMails
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Fetching messages for folder [{0}] failed!", pFolder)
|
||||
Logger.Error(ex)
|
||||
Return New List(Of IMail)
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Get_IMAPMessage(pClient As Imap, pMessageId As String, Optional pFolder As String = "Inbox") As IMail
|
||||
Logger.Info("Fetching Message [{0}]", pMessageId)
|
||||
|
||||
Dim oMail As IMail = Nothing
|
||||
|
||||
Try
|
||||
Logger.Debug("Fetching Folder [{0}]", pFolder)
|
||||
Dim oStatus As FolderStatus = pClient.Select(pFolder)
|
||||
|
||||
Logger.Debug("Fetching UUIDs")
|
||||
Dim oUUIDs As List(Of Long) = pClient.Search(Flag.All)
|
||||
Logger.Debug("Fetching Mails")
|
||||
|
||||
DisableExcessiveLogging = True
|
||||
Dim oInfos As List(Of MessageInfo) = pClient.GetMessageInfoByUID(oUUIDs)
|
||||
DisableExcessiveLogging = False
|
||||
|
||||
Dim oMailInfo = oInfos.Where(Function(i) i.Envelope.MessageID = pMessageId).FirstOrDefault()
|
||||
|
||||
If oMailInfo IsNot Nothing Then
|
||||
DisableExcessiveLogging = True
|
||||
Dim oMailData As Byte() = pClient.GetMessageByUID(oMailInfo.UID)
|
||||
DisableExcessiveLogging = False
|
||||
oMail = MailBuilder.CreateFromEml(oMailData)
|
||||
End If
|
||||
|
||||
Logger.Debug("Email fetched!")
|
||||
|
||||
Return oMail
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Fetching message with MessageID [{0}] failed!", pMessageId)
|
||||
Logger.Error(ex)
|
||||
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Send_SMTPMessage(pClient As Smtp, pSender As String, pReceiver As String, pSubject As String, pBody As String) As Boolean
|
||||
Logger.Info("Sending Message with Subject [{0}]", pSubject)
|
||||
|
||||
Try
|
||||
Dim oBuilder As New MailBuilder()
|
||||
oBuilder.From.Add(New Headers.MailBox(pSender))
|
||||
oBuilder.To.Add(New Headers.MailBox(pReceiver))
|
||||
oBuilder.Subject = pSubject
|
||||
oBuilder.Text = pBody
|
||||
|
||||
Dim oMail As IMail = oBuilder.Create()
|
||||
Dim oResult As ISendMessageResult = pClient.SendMessage(oMail)
|
||||
|
||||
If oResult.Status = SendMessageStatus.Success Then
|
||||
Logger.Debug("Message sent successful!")
|
||||
Return True
|
||||
|
||||
Else
|
||||
Logger.Warn("Message sending failed. Status: [{0}]", oResult.Status)
|
||||
Return False
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Message sending failed.")
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Loads an eml file from disk and returns the IMail representation of it
|
||||
''' </summary>
|
||||
''' <param name="pFileName">Path to the eml file</param>
|
||||
''' <returns>The IMail object</returns>
|
||||
Public Function Load_Email(pFileName As String) As IMail
|
||||
Dim oFileName As String = MaybeConvert_MsgToEml(pFileName)
|
||||
Return MailBuilder.CreateFromEmlFile(oFileName)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Removes all attachments from an EML file and saves it to a temporary file.
|
||||
''' </summary>
|
||||
''' <param name="pFileName">The EML file to process.</param>
|
||||
''' <param name="pSuffix">The optional suffix to add to the original filename.</param>
|
||||
''' <returns>The path of the new EML without attachments.</returns>
|
||||
Public Function Remove_AttachmentsFromEmail(pFileName As String, Optional pSuffix As String = "") As String
|
||||
Try
|
||||
' Convert possible msg file to eml
|
||||
Dim oEmlPath As String = MaybeConvert_MsgToEml(pFileName)
|
||||
|
||||
' Clean and version new path
|
||||
Dim oTempPath As String = Path.Combine(Path.GetTempPath(), Add_FilenameSuffix(oEmlPath, pSuffix, ".eml"))
|
||||
Dim oCleanedPath As String = FileEx.GetCleanPath(oTempPath)
|
||||
Dim oVersionedPath As String = FileEx.GetVersionedFilename(oCleanedPath)
|
||||
|
||||
' Load eml file
|
||||
Dim oMail = MailBuilder.CreateFromEmlFile(oEmlPath)
|
||||
|
||||
' Remove attachments and save
|
||||
oMail.RemoveAttachments()
|
||||
oMail.Save(oVersionedPath)
|
||||
|
||||
Return oVersionedPath
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Save_AttachmentsToDisk(pFileName As String) As List(Of String)
|
||||
Try
|
||||
Dim oAttachmentPaths As New List(Of String)
|
||||
Dim oEmlFile As String = MaybeConvert_MsgToEml(pFileName)
|
||||
Dim oMail = MailBuilder.CreateFromEmlFile(oEmlFile)
|
||||
Dim oTempPath As String = IO.Path.GetTempPath()
|
||||
|
||||
If oMail.Attachments.Count = 0 Then
|
||||
Return New List(Of String)
|
||||
End If
|
||||
|
||||
For Each oAttachment As MimeData In oMail.Attachments
|
||||
Dim oPath As String = IO.Path.Combine(oTempPath, oAttachment.SafeFileName)
|
||||
Dim oVersionedPath As String = FileEx.GetVersionedFilename(oPath)
|
||||
|
||||
oAttachment.Save(oVersionedPath)
|
||||
oAttachmentPaths.Add(oVersionedPath)
|
||||
TempFiles.Add(oVersionedPath)
|
||||
Next
|
||||
|
||||
Return oAttachmentPaths
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
|
||||
Return New List(Of String)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Sub Clear_TempFiles()
|
||||
Logger.Info("Cleaning [{0}] email temp files", TempFiles.Count)
|
||||
For Each oFile In TempFiles
|
||||
Try
|
||||
IO.File.Delete(oFile)
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Could not clean temp file [{0}]", oFile)
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
|
||||
TempFiles.Clear()
|
||||
End Sub
|
||||
|
||||
Public Function Get_MessageDate(Mail As IMail) As Date
|
||||
Try
|
||||
Dim oDate = Mail.Date
|
||||
Return oDate
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Could not get Date from Mail [{0}]", Mail.MessageID)
|
||||
Logger.Error(ex)
|
||||
Return Date.MinValue
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Get_MessageSender(Mail As IMail) As String
|
||||
Try
|
||||
Dim oAddress = Mail.From.First()
|
||||
|
||||
If oAddress Is Nothing Then
|
||||
Logger.Warn("Could not get MessageSender from Mail [{0}]", Mail.MessageID)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return oAddress.Address
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Could not get MessageSender from Mail [{0}]", Mail.MessageID)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Get_MessageReceiver(Mail As IMail) As String
|
||||
Try
|
||||
Dim oAddress = Mail.To.FirstOrDefault()
|
||||
|
||||
If oAddress Is Nothing Then
|
||||
Logger.Warn("Could not get MessageReceiver from Mail [{0}]", Mail.MessageID)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Dim oMailBox = oAddress.GetMailboxes().First()
|
||||
|
||||
If oMailBox Is Nothing Then
|
||||
Logger.Warn("Could not get MessageReceiver from Mail [{0}]", Mail.MessageID)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return oMailBox.Address
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Convert_ToEml(pFilePath As String) As String
|
||||
Return MaybeConvert_MsgToEml(pFilePath)
|
||||
End Function
|
||||
|
||||
Private Function MaybeConvert_MsgToEml(pEmailFilePath As String) As String
|
||||
Dim oInfo As New FileInfo(pEmailFilePath)
|
||||
|
||||
If oInfo.Extension.ToUpper = ".EML" Then
|
||||
Return pEmailFilePath
|
||||
|
||||
ElseIf oInfo.Extension.ToUpper = ".MSG" Then
|
||||
Return DoConvertMsgToEmlFile(pEmailFilePath)
|
||||
|
||||
Else
|
||||
Return Nothing
|
||||
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function DoConvertMsgToEmlFile(pMsgFile As String) As String
|
||||
Try
|
||||
Logger.Debug("Converting Msg file to Eml: [{0}]", pMsgFile?.ToString)
|
||||
|
||||
Dim oTempPath As String = IO.Path.GetTempPath()
|
||||
Dim oFileNameWithoutExtension = Path.GetFileNameWithoutExtension(pMsgFile)
|
||||
Dim oFileNameWithoutInvalidChars = Language.Utils.RemoveInvalidCharacters(oFileNameWithoutExtension)
|
||||
Dim oEmlPath As String = IO.Path.Combine(oTempPath, $"{oFileNameWithoutInvalidChars}.eml")
|
||||
Dim oVersionedPath As String = FileEx.GetVersionedFilename(oEmlPath)
|
||||
|
||||
Logger.Debug("New Path for Eml file: [{0}]", oVersionedPath)
|
||||
|
||||
Using oConverter As New MsgConverter(pMsgFile)
|
||||
Logger.Debug("Converter created")
|
||||
Dim oEmail As IMail = oConverter.CreateMessage()
|
||||
Logger.Debug("Message created")
|
||||
Dim oData As Byte() = oEmail.Render()
|
||||
Logger.Debug("Message rendered")
|
||||
|
||||
oEmail.Save(oVersionedPath)
|
||||
Logger.Debug("Message saved")
|
||||
End Using
|
||||
|
||||
Logger.Info("Msg File successfully converted to Eml: [{0}]", oVersionedPath)
|
||||
TempFiles.Add(oVersionedPath)
|
||||
Return oVersionedPath
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Converting Msg to Eml file failed!")
|
||||
Logger.Error(ex)
|
||||
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function Add_FilenameSuffix(pFilename As String, pSuffix As String, Optional pExtension As String = Nothing)
|
||||
Dim oFileInfo As New FileInfo(pFilename)
|
||||
Dim oExtension As String = oFileInfo.Extension
|
||||
|
||||
If pExtension IsNot Nothing Then
|
||||
If pExtension.StartsWith(".") = False Then
|
||||
oExtension = $".{pExtension}"
|
||||
Else
|
||||
oExtension = pExtension
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim oFileNameWithoutExtension = Path.GetFileNameWithoutExtension(pFilename)
|
||||
|
||||
Return $"{oFileNameWithoutExtension}{pSuffix}{oExtension}"
|
||||
End Function
|
||||
End Class
|
||||
70
Messaging/EventBus.vb
Normal file
70
Messaging/EventBus.vb
Normal file
@@ -0,0 +1,70 @@
|
||||
Imports System.Reflection
|
||||
|
||||
''' <summary>
|
||||
''' A Simple EventBus for .NET
|
||||
''' https://stackoverflow.com/questions/368265/a-simple-event-bus-for-net
|
||||
''' </summary>
|
||||
Public Class EventBus
|
||||
Private Shared _Instance As EventBus
|
||||
Private _Listeners As List(Of EventListenerWrapper) = New List(Of EventListenerWrapper)()
|
||||
|
||||
Public Shared ReadOnly Property Instance As EventBus
|
||||
Get
|
||||
If IsNothing(_Instance) Then
|
||||
_Instance = New EventBus()
|
||||
End If
|
||||
Return _Instance
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Register a form as an event listener.
|
||||
''' </summary>
|
||||
''' <param name="listener">The event listener, usually `Me`</param>
|
||||
Public Sub Register(ByVal listener As Object)
|
||||
If Not _Listeners.Any(Function(l) l.Listener.Equals(listener)) Then
|
||||
_Listeners.Add(New EventListenerWrapper(listener))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub Unregister(ByVal listener As Object)
|
||||
Try
|
||||
_Listeners.RemoveAll(Function(l) l.Listener = listener)
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub PostEvent(ByVal e As Object)
|
||||
_Listeners.
|
||||
Where(Function(l) l.EventType = e.[GetType]()).
|
||||
ToList().
|
||||
ForEach(Sub(l) l.PostEvent(e))
|
||||
End Sub
|
||||
|
||||
Private Class EventListenerWrapper
|
||||
Public Property Listener As Object
|
||||
Public Property EventType As Type
|
||||
Private _method As MethodBase
|
||||
|
||||
Public Sub New(ByVal listener As Object)
|
||||
Me.Listener = listener
|
||||
Dim oType As Type = listener.[GetType]()
|
||||
_method = oType.GetMethod("OnEvent")
|
||||
If _method Is Nothing Then
|
||||
Throw New ArgumentException("Class " & oType.Name & " does not containt method OnEvent")
|
||||
End If
|
||||
Dim oParameters As ParameterInfo() = _method.GetParameters()
|
||||
|
||||
If oParameters.Length <> 1 Then
|
||||
Throw New ArgumentException("Method OnEvent of class " & oType.Name & " have invalid number of parameters (should be one)")
|
||||
End If
|
||||
EventType = oParameters(0).ParameterType
|
||||
End Sub
|
||||
|
||||
Public Sub PostEvent(ByVal e As Object)
|
||||
_method.Invoke(Listener, {e})
|
||||
End Sub
|
||||
End Class
|
||||
End Class
|
||||
404
Messaging/Limilab.vb
Normal file
404
Messaging/Limilab.vb
Normal file
@@ -0,0 +1,404 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Limilabs.Mail
|
||||
Imports Limilabs.Client.IMAP
|
||||
Imports Limilabs.Client.SMTP
|
||||
Imports Limilabs.Client
|
||||
Imports System.Net.Security
|
||||
Imports System
|
||||
Imports System.Security.Authentication
|
||||
Imports Limilabs.Mail.Headers
|
||||
Imports Limilabs.Mail.MIME
|
||||
Imports Limilabs
|
||||
|
||||
Public Class Limilab
|
||||
Private Initialized As Boolean = False
|
||||
Private LogConfig As LogConfig
|
||||
Private Logger As DigitalData.Modules.Logging.Logger
|
||||
Private IMAPServer As String
|
||||
Private IMAPPort As Integer
|
||||
Private User As String
|
||||
Private Password As String
|
||||
Private AuthType As String
|
||||
Public CurrentImapObject As Imap
|
||||
Public ErrorMessage As String
|
||||
Private CURR_ListUIDs As List(Of Long)
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
LogConfig = LogConfig
|
||||
Logger = LogConfig.GetLogger()
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' Initializes the module.
|
||||
''' </summary>
|
||||
''' <param name="oImapServer">IP-Address or Domainname of Server</param>
|
||||
''' <param name="oPort">IMAP-Port</param>
|
||||
''' <param name="oUser">IMAP-Username</param>
|
||||
''' <param name="oPassword">IMAP-Password</param>
|
||||
''' <param name="oAuthType">Auth-Type</param>
|
||||
''' <param name="Folder">The folder to fetch messages from. Defaults to `Inbox`</param>
|
||||
Public Sub InitIMAP(Log_enabled As Boolean, oImapServer As String, oPort As Integer, oUser As String, oPassword As String, oAuthType As String, Optional Folder As String = "Inbox")
|
||||
LOG_Limilab(Log_enabled)
|
||||
IMAPServer = oImapServer
|
||||
IMAPPort = oPort
|
||||
User = oUser
|
||||
Password = oPassword
|
||||
AuthType = oAuthType
|
||||
Initialized = True
|
||||
End Sub
|
||||
Public Function CloseImap() As Boolean
|
||||
Try
|
||||
If Initialized = False Then
|
||||
Return True
|
||||
Else
|
||||
If Not IsNothing(CurrentImapObject) Then
|
||||
CurrentImapObject.Close()
|
||||
End If
|
||||
|
||||
Return True
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return False
|
||||
End Try
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Private Function LOG_Limilab(Log_enabled As Boolean) As Boolean
|
||||
Mail.Log.Enabled = Log_enabled
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Tests connection to a given IMAP Server by connecting and doing a simple message query.
|
||||
''' </summary>
|
||||
''' <returns>True if connection and query were successful. False otherwise.</returns>
|
||||
Public Function IMAPTestLogin() As Boolean
|
||||
Logger.Debug("Starting IMAPTestLogin ...")
|
||||
|
||||
If Initialized = False Then
|
||||
Return False
|
||||
End If
|
||||
Try
|
||||
Logger.Debug("Connecting...")
|
||||
Dim oReturn As Boolean = ImapConnect()
|
||||
If oReturn = True Then
|
||||
CurrentImapObject.Close()
|
||||
End If
|
||||
Return oReturn
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Function IMAPGetUnseenMessageIDs() As List(Of Long)
|
||||
Dim oListuids As New List(Of Long)
|
||||
Logger.Debug("Starting IMAPGetMessageIDs ...")
|
||||
If Initialized = False Then
|
||||
Return Nothing
|
||||
End If
|
||||
Try
|
||||
Dim oConnect As Boolean = ImapConnect()
|
||||
|
||||
If oConnect = True Then
|
||||
oListuids = ImapGetMessageIDs_Unseen()
|
||||
CURR_ListUIDs = oListuids
|
||||
End If
|
||||
Return oListuids
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Function IMAPGetMessageIDs_AllMails() As List(Of Long)
|
||||
Dim oListuids As New List(Of Long)
|
||||
Logger.Debug("Starting IMAPGetMessageIDs ...")
|
||||
If Initialized = False Then
|
||||
Return Nothing
|
||||
End If
|
||||
Try
|
||||
Dim oConnect As Boolean = ImapConnect()
|
||||
|
||||
If oConnect = True Then
|
||||
oListuids = ImapGetMessageIDs_All()
|
||||
CURR_ListUIDs = oListuids
|
||||
End If
|
||||
Return oListuids
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Private Function ImapConnect() As Boolean
|
||||
Try
|
||||
If Initialized = False Then
|
||||
Return True
|
||||
End If
|
||||
Logger.Debug("ImapConnect {0}:{1} with user {2}", IMAPServer, IMAPPort, User)
|
||||
Dim oReturnImap As New Imap()
|
||||
AddHandler oReturnImap.ServerCertificateValidate, AddressOf Validate
|
||||
Logger.Debug($"AUTH_TYPE [{AuthType}]")
|
||||
If AuthType = "SSL/TLS" Then
|
||||
If IMAPPort <> "993" Then
|
||||
Logger.Debug($"Connecting with explizit port [{IMAPPort}]")
|
||||
oReturnImap.Connect(IMAPServer, IMAPPort)
|
||||
Else
|
||||
Logger.Debug("Connecting to IMAP-Server without port...")
|
||||
oReturnImap.ConnectSSL(IMAPServer)
|
||||
End If
|
||||
Logger.Debug($"Connect to [{IMAPServer}] successful!")
|
||||
|
||||
Dim oSupportsStartTLS As Boolean = oReturnImap.SupportedExtensions().Contains(ImapExtension.StartTLS)
|
||||
If oSupportsStartTLS And AuthType.EndsWith("TLS") Then
|
||||
Logger.Debug("Server supports StartTLS, so starting...")
|
||||
oReturnImap.StartTLS()
|
||||
Else
|
||||
Logger.Info("Server supports no StartTLS")
|
||||
oReturnImap.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12
|
||||
End If
|
||||
ElseIf AuthType = "SSL" Then
|
||||
If IMAPPort <> "993" Then
|
||||
Logger.Debug($"Connecting with explizit port [{IMAPPort}]")
|
||||
oReturnImap.Connect(IMAPServer, IMAPPort)
|
||||
Else
|
||||
Logger.Debug("Connecting to IMAP-Server without port...")
|
||||
oReturnImap.ConnectSSL(IMAPServer)
|
||||
End If
|
||||
ElseIf AuthType = "Simple" Then
|
||||
|
||||
End If
|
||||
Logger.Debug(">> Connected to IMAP-Server!")
|
||||
|
||||
Logger.Debug("Login with User and password...")
|
||||
oReturnImap.UseBestLogin(User, Password)
|
||||
Logger.Debug(">> Logged on!")
|
||||
CurrentImapObject = oReturnImap
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
If Not IsNothing(ex.InnerException) Then
|
||||
Logger.Warn("Inner Exception ImapConnect: " + ex.InnerException.Message)
|
||||
End If
|
||||
|
||||
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub Validate(
|
||||
ByVal sender As Object,
|
||||
ByVal e As ServerCertificateValidateEventArgs)
|
||||
|
||||
Const ignoredErrors As SslPolicyErrors =
|
||||
SslPolicyErrors.RemoteCertificateChainErrors Or _ ' self-signed
|
||||
SslPolicyErrors.RemoteCertificateNameMismatch ' name mismatch
|
||||
|
||||
Dim nameOnCertificate As String = e.Certificate.Subject
|
||||
|
||||
If (e.SslPolicyErrors And Not ignoredErrors) = SslPolicyErrors.None Then
|
||||
e.IsValid = True
|
||||
Return
|
||||
End If
|
||||
e.IsValid = False
|
||||
End Sub
|
||||
Private Function ImapGetMessageIDs_Unseen() As List(Of Long)
|
||||
Dim oListuids As New List(Of Long)
|
||||
Try
|
||||
CurrentImapObject.SelectInbox()
|
||||
|
||||
oListuids = CurrentImapObject.Search(Flag.Unseen)
|
||||
|
||||
Return oListuids
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
Private Function ImapGetMessageIDs_All() As List(Of Long)
|
||||
Dim oListuids As New List(Of Long)
|
||||
Try
|
||||
CurrentImapObject.SelectInbox()
|
||||
|
||||
oListuids = CurrentImapObject.Search(Flag.All)
|
||||
|
||||
Return oListuids
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Creates a MailObject and sends Mail via smtp.
|
||||
''' </summary>
|
||||
''' <returns>True if Message was send. False otherwise.</returns>
|
||||
Public Function NewSMTPEmail(mailto As String, mailSubject As String, mailBody As String,
|
||||
mailfrom As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String,
|
||||
AUTH_TYPE As String, SENDER_INSTANCE As String, ADDED_DATETIME As String, Optional attachmentString As String = "", Optional Test As Boolean = False)
|
||||
Try
|
||||
Dim oError As Boolean = False
|
||||
Dim oReceipiants As String()
|
||||
If mailto.Contains(";") Then
|
||||
oReceipiants = mailto.Split(";")
|
||||
Else
|
||||
ReDim Preserve oReceipiants(0)
|
||||
oReceipiants(0) = mailto
|
||||
End If
|
||||
For Each oMailReceipiant As String In oReceipiants
|
||||
Logger.Debug($"oMailReceipiant [{oMailReceipiant}]")
|
||||
Logger.Debug($"mailsmtp [{mailsmtp}]")
|
||||
Logger.Debug($"mailport [{mailport}]")
|
||||
Logger.Debug($"mailSubject [{mailSubject}]")
|
||||
|
||||
Dim oMailBuilder As New MailBuilder()
|
||||
oMailBuilder.From.Add(New MailBox(mailfrom))
|
||||
oMailBuilder.[To].Add(New MailBox(oMailReceipiant))
|
||||
oMailBuilder.Subject = mailSubject
|
||||
If ADDED_DATETIME <> "" Then
|
||||
mailBody &= "<p>Creation-time: " & ADDED_DATETIME
|
||||
End If
|
||||
If Test = True Then
|
||||
oMailBuilder.Html = $"This is a Testmail! <p> The body-text will be replaced within profile! <p> mailsmtp: {mailsmtp} <br> mailport: {mailport}
|
||||
<br> mailUser: {mailUser} <br> mailPW: XXXX <br> AUTH_TYPE: {AUTH_TYPE}"
|
||||
|
||||
Else
|
||||
oMailBuilder.Html = mailBody
|
||||
End If
|
||||
|
||||
Logger.Debug($"mailBody [{oMailBuilder.Html.ToString}]")
|
||||
|
||||
If attachmentString <> "" Then
|
||||
' Read attachment from disk, add it to Attachments collection
|
||||
If System.IO.File.Exists(attachmentString) Then
|
||||
Dim oAttachment As MimeData = oMailBuilder.AddAttachment(attachmentString)
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim email As IMail = oMailBuilder.Create()
|
||||
' Send the message
|
||||
Using oSmtp As New Smtp()
|
||||
AddHandler oSmtp.ServerCertificateValidate, AddressOf Validate
|
||||
Logger.Debug($"AUTH_TYPE [{AUTH_TYPE}]")
|
||||
If AUTH_TYPE = "SSL" Then
|
||||
|
||||
Try
|
||||
If mailport <> "465" Then
|
||||
Logger.Debug($"Connecting with explizit port [{mailport}]")
|
||||
oSmtp.Connect(mailsmtp, mailport)
|
||||
Logger.Debug($"Connect to [{mailsmtp}] successful!")
|
||||
Else
|
||||
oSmtp.ConnectSSL(mailsmtp)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
ElseIf AUTH_TYPE = "SSL/TLS" Then
|
||||
'##########################################################################################
|
||||
'Tested with ExchangeServer SWB 22.10.2021
|
||||
'##########################################################################################
|
||||
If mailport <> "587" Then
|
||||
Logger.Debug($"Connecting with explizit port [{mailport}]")
|
||||
oSmtp.Connect(mailsmtp, mailport)
|
||||
Else
|
||||
oSmtp.Connect(mailsmtp)
|
||||
End If
|
||||
Logger.Debug($"Connect to [{mailsmtp}] successful!")
|
||||
Dim supportsStartTLS As Boolean = oSmtp.SupportedExtensions().Contains(SmtpExtension.StartTLS)
|
||||
If supportsStartTLS = True Then
|
||||
oSmtp.StartTLS()
|
||||
Logger.Debug($"TLS started!")
|
||||
Else
|
||||
Logger.Info("Server supports no StartTLS")
|
||||
oSmtp.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12
|
||||
End If
|
||||
Else
|
||||
oSmtp.Connect(mailsmtp)
|
||||
End If
|
||||
Logger.Debug($"mailUser [{mailUser}]")
|
||||
oSmtp.UseBestLogin(mailUser, mailPW) ' remove if not needed
|
||||
|
||||
oSmtp.SendMessage(email)
|
||||
Logger.Info("Message to " & oMailReceipiant & " has been send.")
|
||||
oSmtp.Close()
|
||||
End Using
|
||||
Next
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
Public Function GetMailInfo(UID As Long) As Boolean
|
||||
Try
|
||||
Dim eml = CurrentImapObject.GetMessageByUID(UID)
|
||||
Dim email As IMail = New MailBuilder().CreateFromEml(eml)
|
||||
' Subject
|
||||
Console.WriteLine(email.Subject)
|
||||
|
||||
' From
|
||||
For Each m As MailBox In email.From
|
||||
Console.WriteLine(m.Address)
|
||||
Console.WriteLine(m.Name)
|
||||
Next
|
||||
' Date
|
||||
Console.WriteLine(email.[Date])
|
||||
' Text body of the message
|
||||
Console.WriteLine(email.Text)
|
||||
' Html body of the message
|
||||
Console.WriteLine(email.Html)
|
||||
' Custom header
|
||||
Console.WriteLine(email.Document.Root.Headers("x-spam-value"))
|
||||
' Save all attachments to disk
|
||||
For Each mime As MimeData In email.Attachments
|
||||
mime.Save("c:\" + mime.SafeFileName)
|
||||
Next
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
Public Function GetMailObjects() As ArrayList
|
||||
Try
|
||||
Dim WORKMAIL_LIST As New ArrayList()
|
||||
For Each oUID In CURR_ListUIDs
|
||||
Dim oEml = CurrentImapObject.GetMessageByUID(oUID)
|
||||
Dim oEmail As IMail = New MailBuilder().CreateFromEml(oEml)
|
||||
WORKMAIL_LIST.Add(oEmail)
|
||||
Next
|
||||
Return WORKMAIL_LIST
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
Public Function IMAP_DeleteByUID(UID As Long) As Boolean
|
||||
Try
|
||||
If Not IsNothing(CurrentImapObject) Then
|
||||
CurrentImapObject.DeleteMessageByUID(UID)
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
ErrorMessage = ex.Message
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
23
Messaging/MailLicense.xml
Normal file
23
Messaging/MailLicense.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<License>
|
||||
<Id>4dc5ef40-f1a9-468b-994c-b7ed600ad878</Id>
|
||||
<ProductName>Mail.dll</ProductName>
|
||||
<SubscriptionUntil>2022-07-29</SubscriptionUntil>
|
||||
<RegisteredTo>Digital Data GmbH</RegisteredTo>
|
||||
<LicenseType>single developer</LicenseType>
|
||||
<BuyerName>Digital Data GmbH</BuyerName>
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
||||
<SignedInfo>
|
||||
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
|
||||
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
|
||||
<Reference URI="">
|
||||
<Transforms>
|
||||
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
|
||||
</Transforms>
|
||||
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
|
||||
<DigestValue>75MRtl4ipYelIZYlpT8O7QDX9Zc=</DigestValue>
|
||||
</Reference>
|
||||
</SignedInfo>
|
||||
<SignatureValue>Raxfkz6DfQVs/sMvH+F2nH0eHXD8FoUFSdP3t7AgBUdpABJQx86srlyuMSEhXPlc1THCqPouEVob4RsWnd9OXvTiPPSOUSK9zuNG6uz93KLAhpSD5PraAgBCF4jwZArlAp7aCNfZpHqQ3w6TRHS+CfravUU0AHHG3MZ1ZcRkGuo=</SignatureValue>
|
||||
</Signature>
|
||||
</License>
|
||||
140
Messaging/Messaging.vbproj
Normal file
140
Messaging/Messaging.vbproj
Normal file
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AF664D85-0A4B-4BAB-A2F8-83110C06553A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DigitalData.Modules.Messaging</RootNamespace>
|
||||
<AssemblyName>DigitalData.Modules.Messaging</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.Messaging.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.Messaging.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mail">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\Limilabs\Mail.dll\Mail.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.15\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Email.vb" />
|
||||
<Compile Include="EventBus.vb" />
|
||||
<Compile Include="Email2.vb" />
|
||||
<Compile Include="Limilab.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="SMS.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Filesystem\Filesystem.vbproj">
|
||||
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
||||
<Name>Filesystem</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Language\Language.vbproj">
|
||||
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
||||
<Name>Language</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="MailLicense.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
13
Messaging/My Project/Application.Designer.vb
generated
Normal file
13
Messaging/My Project/Application.Designer.vb
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
10
Messaging/My Project/Application.myapp
Normal file
10
Messaging/My Project/Application.myapp
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>false</MySubMain>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>1</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
35
Messaging/My Project/AssemblyInfo.vb
Normal file
35
Messaging/My Project/AssemblyInfo.vb
Normal file
@@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
' die einer Assembly zugeordnet sind.
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Messaging")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("Messaging")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
<Assembly: Guid("60d22737-01f3-4ea2-b6f6-ad312dc07c53")>
|
||||
|
||||
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
'
|
||||
' Hauptversion
|
||||
' Nebenversion
|
||||
' Buildnummer
|
||||
' Revision
|
||||
'
|
||||
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.7.3.0")>
|
||||
<Assembly: AssemblyFileVersion("1.7.3.0")>
|
||||
63
Messaging/My Project/Resources.Designer.vb
generated
Normal file
63
Messaging/My Project/Resources.Designer.vb
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports System
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
'''<summary>
|
||||
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.Modules.Messaging.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
117
Messaging/My Project/Resources.resx
Normal file
117
Messaging/My Project/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
73
Messaging/My Project/Settings.Designer.vb
generated
Normal file
73
Messaging/My Project/Settings.Designer.vb
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Automatische My.Settings-Speicherfunktion"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.DigitalData.Modules.Messaging.My.MySettings
|
||||
Get
|
||||
Return Global.DigitalData.Modules.Messaging.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
7
Messaging/My Project/Settings.settings
Normal file
7
Messaging/My Project/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
3
Messaging/SMS.vb
Normal file
3
Messaging/SMS.vb
Normal file
@@ -0,0 +1,3 @@
|
||||
Public Class SMS
|
||||
|
||||
End Class
|
||||
5
Messaging/packages.config
Normal file
5
Messaging/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.7.15" targetFramework="net461" />
|
||||
<package id="S22.Imap" version="3.6.0.0" targetFramework="net461" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user