Messaging: Add MailSender class
This commit is contained in:
@@ -5,7 +5,6 @@ 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
|
||||
@@ -41,17 +40,17 @@ Public Class Email2
|
||||
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
|
||||
Public Function New_SMTPConnection(pSMTP As Limilabs.Client.SMTP.Smtp, pServer As String, pUsername As String, pPassword As String, pSecurity As EmailSecurity, Optional pPort As Integer = 0) As Limilabs.Client.SMTP.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
|
||||
oPort = Limilabs.Client.SMTP.Smtp.DefaultSSLPort
|
||||
|
||||
Else
|
||||
oPort = Smtp.DefaultPort
|
||||
oPort = Limilabs.Client.SMTP.Smtp.DefaultPort
|
||||
|
||||
End If
|
||||
|
||||
@@ -146,7 +145,7 @@ Public Class Email2
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Test_SMTPLogin(pClient As Smtp) As Boolean
|
||||
Public Function Test_SMTPLogin(pClient As Limilabs.Client.SMTP.Smtp) As Boolean
|
||||
Logger.Info("Testing Login to IMAP Server")
|
||||
|
||||
Try
|
||||
@@ -241,7 +240,7 @@ Public Class Email2
|
||||
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
|
||||
Public Function Send_SMTPMessage(pClient As Limilabs.Client.SMTP.Smtp, pSender As String, pReceiver As String, pSubject As String, pBody As String) As Boolean
|
||||
Logger.Info("Sending Message with Subject [{0}]", pSubject)
|
||||
|
||||
Try
|
||||
@@ -252,9 +251,9 @@ Public Class Email2
|
||||
oBuilder.Text = pBody
|
||||
|
||||
Dim oMail As IMail = oBuilder.Create()
|
||||
Dim oResult As ISendMessageResult = pClient.SendMessage(oMail)
|
||||
Dim oResult As Limilabs.Client.SMTP.ISendMessageResult = pClient.SendMessage(oMail)
|
||||
|
||||
If oResult.Status = SendMessageStatus.Success Then
|
||||
If oResult.Status = Limilabs.Client.SMTP.SendMessageStatus.Success Then
|
||||
Logger.Debug("Message sent successful!")
|
||||
Return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user