Const ConnectNormal = 0
Const ConnectSSLAuto = 1
Const ConnectSTARTTLS = 2
Const ConnectDirectSSL = 3
Const ConnectTryTLS = 4
Sub EmailAddrTest()
Dim oSmtp As New EASendMailObjLib.Mail
Dim ConnectTryTLS
oSmtp.LicenseCode = "TryIt"
' Set your sender email address
oSmtp.FromAddr = "youremail@yahoo.com"
' Add recipient email address
oSmtp.AddRecipientEx "emailaddressbeingtested@gmail.com", 0
' Set email subject
oSmtp.Subject = "simple email from VB 6.0 project"
' Set email body
oSmtp.BodyText = "this is a test email sent from VB 6.0 project, do not reply"
' Your SMTP server address
oSmtp.ServerAddr = "smtp.yahoo.com"
' User and password for ESMTP authentication, if your server doesn't require
' User authentication, please remove the following codes.
oSmtp.UserName = "yours@yahoo.com"
oSmtp.Password = "your password here"
' ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically
oSmtp.ConnectType = ConnectTryTLS
' If your server uses 587 port
' oSmtp.ServerPort = 587
' If your server uses 25/587/465 port with SSL/TLS
' oSmtp.ConnectType = ConnectSSLAuto
' oSmtp.ServerPort = 25 ' 25 or 587 or 465
MsgBox "start to send email ..."
If oSmtp.SendMail() = 0 Then
MsgBox "email was sent successfully!"
Else
MsgBox "failed to send email with the following error:" & oSmtp.GetLastErrDescription()
End If
End Sub