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 |
3 | Gmail API (Google OAUTH is required) |
4 | Microsoft Graph API (MS OAUTH is required) |
Remarks
Standard SMTP protocol based on TCP/IP, all email servers support this protocol, Exchange Server also supports SMTP protocol. Using SMTP protocol is always recommended.
Exchange WebDAV is a set of methods based on the HTTP protocol to manage users, messages in Microsoft Exchange Server. We can use HTTP or HTTP/HTTPS protocol to send email with Exchange WebDAV instead of SMTP protocol. But since Exchange 2007, WebDAV service is disabled by default, so we only suggest that you use WebDAV protocol in Exchange 2000/2003.
Exchange Web Services (EWS), an alternative to the MAPI protocol, is a documented SOAP based protocol introduced with Exchange Server 2007. We can use HTTP or HTTPS protocol to send email with Exchange Web Services (EWS) instead of SMTP protocol. We only suggest that you use EWS protocol in Exchange 2007/2010/2013/2016/2019/Office 365 or later version.
Gmail supports SMTP + OAUTH, but the API (https://mail.google.com/) scope is restricted API which requests to have full access to the Gmail account. Restricted API is throttled before your project is authenticated by Google.
Using less restricted API (https://www.googleapis.com/auth/gmail.send) scope to send email via Gmail server is recommended.
Only Office365 supports this protocol.
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