MS Messaging
This commit is contained in:
parent
c8b20d3a8c
commit
0fe90141b1
@ -14,6 +14,7 @@ Public Class MailSender
|
||||
Private AuthType As String
|
||||
|
||||
Private Session As Smtp = Nothing
|
||||
Public Connected2Server As Boolean = False
|
||||
|
||||
Const SMTP_IGNORED_ERRORS As SslPolicyErrors =
|
||||
SslPolicyErrors.RemoteCertificateChainErrors Or ' self-signed
|
||||
@ -120,7 +121,7 @@ Public Class MailSender
|
||||
End Try
|
||||
|
||||
Session = oSession
|
||||
|
||||
Connected2Server = True
|
||||
Return True
|
||||
End Function
|
||||
|
||||
@ -176,6 +177,10 @@ Public Class MailSender
|
||||
|
||||
Private Function SendMailTo(pSession As Smtp, pSendTo As String, pSendFrom As String, pSubject As String, pBody As String, pCreationTime As Date, pAttachments As List(Of String), pTest As Boolean)
|
||||
Try
|
||||
If IsNothing(pSession) Then
|
||||
Logger.Info("ATTENTION-ERROR: pSession is nothing!")
|
||||
Return False
|
||||
End If
|
||||
Logger.Debug("Preparing to send mail to [{0}]", pSendTo)
|
||||
|
||||
Dim oMailBuilder As New Limilabs.Mail.MailBuilder()
|
||||
@ -190,6 +195,10 @@ Public Class MailSender
|
||||
oMailBuilder = AddAttachments(oMailBuilder, pAttachments)
|
||||
|
||||
Logger.Debug("Now sending mail..")
|
||||
If IsNothing(oMailBuilder) Then
|
||||
Logger.Info("ATTENTION-ERROR: oMailBuilder is nothing!")
|
||||
Return False
|
||||
End If
|
||||
Dim oMail = oMailBuilder.Create()
|
||||
pSession.SendMessage(oMail)
|
||||
Logger.Info("Mail to [{0}] has been sent.", pSendTo)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user