UseStartTLS Property



Tells MailBee whether to use dedicated port connection or STARTTLS connection.

Dedicated port connection uses specially provided SSL port number: usually 465 for SMTP, 995 for POP3, 993 for IMAP4.

STARTTLS connection uses regular ports (25 for SMTP, 110 for POP3, 143 for IMAP4) but uses special command STARTTLS to switch connection to SSL mode.

If UseStartTLS=False, you must explicitly set dedicated port number for SMTP, POP3 or IMAP4 object. For example:

Mailer.PortNumber = 995 ' Set dedicated SSL port for POP3 object


Note that in case of SMTP MailBee will issue STARTTLS command only if it's supported by the server. If the server does not support it, the connection will not be encrypted. You may consider to use dedicated SSL port connection if your server supports SSL but not STARTTLS. To check if your SMTP server supports STARTTLS, use SMTP.SupportsStartTLS property.

Refer to your mail server documentation or configuration to determine what type of connection your server supports: some servers support both types, others - only one of the types, but many servers do not support SSL/TLS at all.


Value Type: Boolean
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.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
  MsgBox Mailer.ErrDesc
End If

See Also:

SMTP.PortNumber Property
POP3.PortNumber Property
IMAP4.PortNumber Property


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