Merge branch 'master' of http://git.dd:3000/AppStd/Modules
This commit is contained in:
commit
76ce9c075d
@ -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,24 +37,32 @@ 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
|
||||
Dim oSuccessfulSends As New List(Of String)
|
||||
Dim oFailedSends As New List(Of String)
|
||||
Try
|
||||
Dim oSuccessfulSends As New List(Of String)
|
||||
Dim oFailedSends As New List(Of String)
|
||||
|
||||
For Each oSendToAddress In pSendTo
|
||||
Dim oResult = SendMailTo(oSendToAddress, pSendFrom, pSubject, pBody, pCreationTime, pAttachments, pTest)
|
||||
For Each oSendToAddress In pSendTo
|
||||
Dim oResult = SendMailTo(oSendToAddress, pSendFrom, pSubject, pBody, pCreationTime, pAttachments, pTest)
|
||||
|
||||
If oResult = True Then
|
||||
oSuccessfulSends.Add(oSendToAddress)
|
||||
Else
|
||||
oFailedSends.Add(oSendToAddress)
|
||||
End If
|
||||
Next
|
||||
If oResult = True Then
|
||||
oSuccessfulSends.Add(oSendToAddress & "|" & pSubject)
|
||||
Else
|
||||
oFailedSends.Add(oSendToAddress & "|" & pSubject)
|
||||
End If
|
||||
Next
|
||||
|
||||
Logger.Debug("Sent [{0}] mails.", pSendTo.Count)
|
||||
Logger.Debug("Successful [{0}]", oSuccessfulSends.Count)
|
||||
Logger.Debug("Failed [{0}]", oFailedSends.Count)
|
||||
Logger.Debug("Sent [{0}] mails.", pSendTo.Count)
|
||||
Logger.Debug("Successful [{0}]", oSuccessfulSends.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
|
||||
|
||||
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)
|
||||
@ -81,12 +90,12 @@ Namespace Mail
|
||||
Logger.Debug("Now sending mail..")
|
||||
Dim oMail = oMailBuilder.Create()
|
||||
oClient.SendMessage(oMail)
|
||||
Logger.Info("Mail to [{0}] has been sent.", pSendTo)
|
||||
Logger.Info("Mail to [{0}] has been sent.", pSendTo + "|" + pSubject)
|
||||
|
||||
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
|
||||
|
||||
@ -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")>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user