Protocol Property


This property indicates the server protocol (SMTP/Exchange Web Service/Exchange WebDAV).

Data Type: Long

Value Meaning
0 (Default) Standard SMTP Protocol
1 Exchange Web Service - EWS - Exchange Server 2007/2010/2013/2016/2019/Office 365
2 Exchange Web DAV - Exchange Server 2000/2003

Remarks

Example

[Visual Basic] To get the full samples of EASendMail, please refer to Samples section.

[VB6, VBA - Send Email with Stanard SMTP Protocol]
Const ConnectNormal = 0
Const ConnectSSLAuto = 1
Const ConnectSTARTTLS = 2
Const ConnectDirectSSL = 3
Const ConnectTryTLS = 4

Private Sub Send_Email_SMTP()
    
    Dim oSmtp As New EASendMailObjLib.Mail
    oSmtp.LicenseCode = "TryIt"

    ' Your SMTP server address
    oSmtp.ServerAddr = "smtp.emailarchitect.net"
    
    ' User and password for ESMTP authentication
    oSmtp.UserName = "test@emailarchitect.net"
    oSmtp.Password = "testpassword"

    ' 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 465 port with SSL/TLS 
    ' oSmtp.ConnectType = ConnectSSLAuto 
    ' oSmtp.ServerPort = 465

    ' If your server uses 25/587 port with SSL/TLS 
    ' oSmtp.ConnectType = ConnectSSLAuto 
    ' oSmtp.ServerPort = 587

    ' Set your sender email address
    oSmtp.FromAddr = "test@emailarchitect.net"

    ' Add recipient email address
    oSmtp.AddRecipientEx "support@emailarchitect.net", 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"
    
    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


[VB6, VBA - Send Email with Exchange Web Service - EWS] Const ConnectNormal = 0 Const ConnectSSLAuto = 1 Const ConnectSTARTTLS = 2 Const ConnectDirectSSL = 3 Const ConnectTryTLS = 4 Private Sub Send_Email_Exchange_EWS() Dim oSmtp As New EASendMailObjLib.Mail oSmtp.LicenseCode = "TryIt" ' Your Exchange server address oSmtp.ServerAddr = "exch.emailarchitect.net" ' Set Exchange Web Service Protocol - EWS - Exchange 2007/2010/2013/2016/2019 oSmtp.Protocol = 1 ' User and password for Exchange Web Service authentication oSmtp.UserName = "test" oSmtp.Password = "testpassword" ' By default, Exchange Web Service requires SSL connection. oSmtp.ConnectType = ConnectSSLAuto ' Set your sender email address oSmtp.FromAddr = "test@emailarchitect.net" ' Add recipient email address oSmtp.AddRecipientEx "support@emailarchitect.net", 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" 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
[VB6, VBA - Send Email with Exchange WebDAV] Const ConnectNormal = 0 Const ConnectSSLAuto = 1 Const ConnectSTARTTLS = 2 Const ConnectDirectSSL = 3 Const ConnectTryTLS = 4 Private Sub Send_Email_Exchange_WebDav() Dim oSmtp As New EASendMailObjLib.Mail oSmtp.LicenseCode = "TryIt" ' Your Exchange server address oSmtp.ServerAddr = "exch.emailarchitect.net" ' Set Exchange WebDav Protocol - Exchange 2000/2003 oSmtp.Protocol = 2 ' User and password for Exchange WebDav authentication oSmtp.UserName = "test" oSmtp.Password = "testpassword" ' If your WebDav requires SSL connection, please add this line ' oSmtp.ConnectType = ConnectSSLAuto ' Set your sender email address oSmtp.FromAddr = "test@emailarchitect.net" ' Add recipient email address oSmtp.AddRecipientEx "support@emailarchitect.net", 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" 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

Online Tutorial

Send Email using SMTP over SSL/TLS in Delphi
Send Email using SMTP over SSL/TLSin VB6
Send Email using SMTP over SSL/TLS in VC++

Send Email using Exchange WebDAV in Delphi
Send Email using Exchange WebDAV in VB6
Send Email using Exchange WebDAV in VC++

Send Email using Exchange Web Service in Delphi
Send Email using Exchange Web Service in VB6
Send Email using Exchange Web Service in VC++

See Also

User Authentication and SSL Connection
From, ReplyTo, Sender and Return-Path
Process Bounced Email (Non-Delivery Report) and Email Tracking