Protocol Property


Specifies security protocol to be used.

By default, the most secure available protocol is used (currently TLS). However, the default setting does not specify the TLS version so that it's up to the OS. The modern Windows 10 versions tend to use TLS 1.2 in this case. To force using TLS 1.2, you need to specify this property manually. However, it won't work if the mail server doesn't support TLS 1.2 (such servers still exist). Allowed values:


Note that TLS 1.3 support is experimental. Too few mail servers still support it, seems to work with GMail SMTP in StartTLS mode, provided that TLS 1.3 is enabled in Windows.


Value Type: Long
Parameters: None 

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.SMTP")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.SMTP")
'In ASP use Response.Write instead of MsgBox
Mailer.EnableLogging = True
Mailer.LogFilePath = "C:\Temp\smtp_log.txt"
Mailer.ClearLog
Mailer.LicenseKey = "put your license key here"

' Set SSL connection over STARTTLS command
Mailer.SSL.Enabled = True
Mailer.SSL.UseStartTLS = True

Mailer.SSL.Protocol = 6 ' Force TLS 1.2

Mailer.ServerName = "mail.server.com"
Mailer.Message.ToAddr = "bill@yoursite.com"
Mailer.Message.FromAddr = "joe@mysite.com"
Mailer.Message.Subject = "Hello"
Mailer.Message.BodyText = "Body"
If Mailer.Connect Then
  Mailer.Send
  Mailer.Disconnect
Else
  If Mailer.ErrCode = 12 Then
    MsgBox "SSL Error #" & Mailer.SSL.SSLError
  Else
    MsgBox Mailer.ErrDesc
  End If
End If

See Also:

SSL Object


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.