MS Mesaging 1.9.3.0 SessionState
This commit is contained in:
parent
c4df4a2f5c
commit
e22b108514
@ -5,11 +5,12 @@ Namespace Mail
|
|||||||
Public Class MailSender
|
Public Class MailSender
|
||||||
Inherits BaseClass
|
Inherits BaseClass
|
||||||
|
|
||||||
Private Property MailSession As MailSession
|
Public Property MailSession As MailSession
|
||||||
|
|
||||||
Public ReadOnly Property Connected2Server As Boolean
|
Public ReadOnly Property Connected2Server As Boolean
|
||||||
Get
|
Get
|
||||||
If MailSession IsNot Nothing AndAlso MailSession.Session IsNot Nothing Then
|
If MailSession IsNot Nothing AndAlso MailSession.Session IsNot Nothing Then
|
||||||
|
|
||||||
Return MailSession.Session.Connected
|
Return MailSession.Session.Connected
|
||||||
Else
|
Else
|
||||||
Return False
|
Return False
|
||||||
@ -36,24 +37,32 @@ Namespace Mail
|
|||||||
End Function
|
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
|
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
|
||||||
Dim oSuccessfulSends As New List(Of String)
|
Try
|
||||||
Dim oFailedSends As New List(Of String)
|
Dim oSuccessfulSends As New List(Of String)
|
||||||
|
Dim oFailedSends As New List(Of String)
|
||||||
|
|
||||||
For Each oSendToAddress In pSendTo
|
For Each oSendToAddress In pSendTo
|
||||||
Dim oResult = SendMailTo(oSendToAddress, pSendFrom, pSubject, pBody, pCreationTime, pAttachments, pTest)
|
Dim oResult = SendMailTo(oSendToAddress, pSendFrom, pSubject, pBody, pCreationTime, pAttachments, pTest)
|
||||||
|
|
||||||
If oResult = True Then
|
If oResult = True Then
|
||||||
oSuccessfulSends.Add(oSendToAddress)
|
oSuccessfulSends.Add(oSendToAddress & "|" & pSubject)
|
||||||
Else
|
Else
|
||||||
oFailedSends.Add(oSendToAddress)
|
oFailedSends.Add(oSendToAddress & "|" & pSubject)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Logger.Debug("Sent [{0}] mails.", pSendTo.Count)
|
Logger.Debug("Sent [{0}] mails.", pSendTo.Count)
|
||||||
Logger.Debug("Successful [{0}]", oSuccessfulSends.Count)
|
Logger.Debug("Successful [{0}]", oSuccessfulSends.Count)
|
||||||
Logger.Debug("Failed [{0}]", oFailedSends.Count)
|
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
|
||||||
|
|
||||||
Return True
|
|
||||||
End Function
|
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)
|
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
|
Return True
|
||||||
|
|
||||||
Catch ex As Exception
|
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)
|
Logger.Error(ex)
|
||||||
|
|
||||||
Return False
|
Return False
|
||||||
|
|||||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.9.2.0")>
|
<Assembly: AssemblyVersion("1.9.3.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.9.2.0")>
|
<Assembly: AssemblyFileVersion("1.9.3.0")>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user