SSL_starttls Property

This property specifies whether current connection uses STARTTLS command to enable SSL/TLS.


Data Type: Long

Value Meaning
0 Direct SSL/TLS
1 STARTTLS(default)

Remarks

Usually, there are two ways to deploy SMTP server to SSL/TLS, one is deploying SMTP port as direct SSL/TLS connection, another way is switching connection from normal channel to SSL/TLS channel by STARTTLS command(rfc 2487). Therefore, you should choose the appropriate value for SSL_starttls property upon your SMTP server configuration. If you're using gmail account, the SSL connection is a MUST.

Usage Example:

 [Visual Basic]    
'Connect server under SSL/TLS by STARTTLS command
Dim oSmtp As EASendMailObjLib.Mail
Set oSmtp = new EASendMailObjLib.Mail 
'Before using Mail, LicenseCode must be assigned.
oSmtp.LicenseCode = "TryIt" 

oSmtp.SSL_init
oSmtp.SSL_starttls = 1
oSmtp.Subject = "test for ssl"
oSmtp.BodyText = "test body"

oSmtp.FromAddr = "test@adminsystem.net"
oSmtp.AddRecipient "Support Team", "Support@AdminSystem.NET", 0 

If oSmtp.SendMail() = 0 Then
  MsgBox "Message delivered"
Else
  MsgBox oSmtp.GetLastErrDescription()
End If

oSmtp.SSL_uninit

'Connect server under SSL/TLS by direct SSL/TLS
Dim oSmtp As EASendMailObjLib.Mail
Set oSmtp = new EASendMailObjLib.Mail 
'Before using Mail, LicenseCode must be assigned.
oSmtp.LicenseCode = "TryIt" 

If oSmtp.SSL_init() <> 0 Then
  MsgBox "initialize ansslplus failed"
End If

oSmtp.SSL_starttls = 0
'SMTP server usually uses 465 as the alone SSL/TLS port
oSmtp.ServerPort = 465 
oSmtp.Subject = "test for ssl"
oSmtp.BodyText = "test body"

oSmtp.FromAddr = "test@adminsystem.net"
oSmtp.AddRecipient "Support Team", "Support@AdminSystem.NET", 0 

If oSmtp.SendMail() = 0 Then
  MsgBox "Message delivered"
Else
  MsgBox oSmtp.GetLastErrDescription()
End If

oSmtp.SSL_uninit
See Also

SSL_init method