Compare commits
2 Commits
27e3462b6e
...
1c86b8091b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c86b8091b | ||
|
|
8738fd8300 |
@@ -20,10 +20,18 @@ Public Class MailSender
|
||||
SslPolicyErrors.RemoteCertificateChainErrors Or ' self-signed
|
||||
SslPolicyErrors.RemoteCertificateNameMismatch ' name mismatch
|
||||
|
||||
Public Class MailSenderOptions
|
||||
Public Property TlsVersion As Security.Authentication.SslProtocols = Security.Authentication.SslProtocols.Default
|
||||
End Class
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
MyBase.New(pLogConfig)
|
||||
End Sub
|
||||
|
||||
Public Function ConnectToServer(pServer As String, pPort As Integer, pUser As String, pPassword As String, pAuthType As String) As Boolean
|
||||
Return ConnectToServer(pServer, pPort, pUser, pPassword, pAuthType)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Start a connection with the specified server and return the SMTP client. Throws if there was an error.
|
||||
''' </summary>
|
||||
@@ -33,7 +41,7 @@ Public Class MailSender
|
||||
''' <param name="pPassword"></param>
|
||||
''' <param name="pAuthType"></param>
|
||||
''' <returns></returns>
|
||||
Public Function ConnectToServer(pServer As String, pPort As Integer, pUser As String, pPassword As String, pAuthType As String) As Boolean
|
||||
Public Function ConnectToServer(pServer As String, pPort As Integer, pUser As String, pPassword As String, pAuthType As String, pOptions As MailSenderOptions) As Boolean
|
||||
Server = pServer
|
||||
Port = pPort
|
||||
User = pUser
|
||||
@@ -51,6 +59,11 @@ Public Class MailSender
|
||||
|
||||
Logger.Debug("Initializing Connection with Auth type [{0}].", pAuthType)
|
||||
|
||||
' Set TLS Version manually if requested
|
||||
If pOptions.TlsVersion <> Security.Authentication.SslProtocols.Default Then
|
||||
oSession.SSLConfiguration.EnabledSslProtocols = pOptions.TlsVersion
|
||||
End If
|
||||
|
||||
If pAuthType = "SSL" Then
|
||||
Try
|
||||
If pPort = 465 Then
|
||||
|
||||
@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("Messaging")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("1.9.0.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("1.9.1.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.9.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.0.0")>
|
||||
<Assembly: AssemblyVersion("1.9.1.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.1.0")>
|
||||
|
||||
Reference in New Issue
Block a user