MS Mesaging 1.9.3.0 SessionState

This commit is contained in:
SchreiberM 2024-03-20 10:32:54 +01:00
parent c4df4a2f5c
commit e22b108514
2 changed files with 27 additions and 18 deletions

View File

@ -5,11 +5,12 @@ Namespace Mail
Public Class MailSender
Inherits BaseClass
Private Property MailSession As MailSession
Public Property MailSession As MailSession
Public ReadOnly Property Connected2Server As Boolean
Get
If MailSession IsNot Nothing AndAlso MailSession.Session IsNot Nothing Then
Return MailSession.Session.Connected
Else
Return False
@ -36,6 +37,7 @@ Namespace Mail
End Function
Public Function SendMail(pSendTo As List(Of String), pSendFrom As String, pSubject As String, pBody As String, pCreationTime As Date, pAttachments As List(Of String), pTest As Boolean) As Boolean
Try
Dim oSuccessfulSends As New List(Of String)
Dim oFailedSends As New List(Of String)
@ -43,9 +45,9 @@ Namespace Mail
Dim oResult = SendMailTo(oSendToAddress, pSendFrom, pSubject, pBody, pCreationTime, pAttachments, pTest)
If oResult = True Then
oSuccessfulSends.Add(oSendToAddress)
oSuccessfulSends.Add(oSendToAddress & "|" & pSubject)
Else
oFailedSends.Add(oSendToAddress)
oFailedSends.Add(oSendToAddress & "|" & pSubject)
End If
Next
@ -54,6 +56,13 @@ Namespace Mail
Logger.Debug("Failed [{0}]", oFailedSends.Count)
Return True
Catch ex As Exception
Logger.Warn("Error in SendMail() - while sending mail [{0} - Subject: {1}]", pSendTo, pSubject)
Logger.Error(ex)
Return False
End Try
End Function
Private Function SendMailTo(pSendTo As String, pSendFrom As String, pSubject As String, pBody As String, pCreationTime As Date, pAttachments As List(Of String), pTest As Boolean)
@ -86,7 +95,7 @@ Namespace Mail
Return True
Catch ex As Exception
Logger.Warn("Error while sending mail to [{0}]", pSendTo)
Logger.Warn("Error in SendMailTo() to [{0} - Subject: {1}]", pSendTo, pSubject)
Logger.Error(ex)
Return False

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.9.2.0")>
<Assembly: AssemblyFileVersion("1.9.2.0")>
<Assembly: AssemblyVersion("1.9.3.0")>
<Assembly: AssemblyFileVersion("1.9.3.0")>