Specifies the protocol (SMTP/Exchange Web Service/Exchange WebDAV) for mail server.
[Visual Basic] Public Enum ServerProtocol
[C#] public enum ServerProtocol
[C++] __value public enum ServerProtocol
[JScript] public enum ServerProtocol
Members
| Members name | Description | 
| SMTP | Specifies that the mail server uses standard SMTP protocol. | 
| ExchangeEWS | Specifies that that the mail server uses Exchange Web Service protocol. Exchange 2007/2010/2013 or later version supports this protocol. | 
| ExchangeWebDAV | Specifies that that the mail server uses Exchange WebDAV protocol. Exchange 2000/2003 supports this protocol. | 
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.
xchange 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 WebDAV protocol in Exchange 2007/2010/2013 or later version.
Examples
[Visual Basic, C#, JavaScript] The following example demonstrates how to send email in Windows 8 Store App. To get the full samples of EASendMail, please refer to Samples section.
[C# - Send Email using SMTP Protocol - Windows Store Apps - XAML]
using EASendMail;
using System.Threading.Tasks;
private async Task SendEmail()
{
    String Result = "";
    try
    {
        SmtpMail oMail = new SmtpMail("TryIt");
        SmtpClient oSmtp = new SmtpClient();
        // Set sender email address, please change it to yours 
        oMail.From = new MailAddress("test@emailarchitect.net");
        // Add recipient email address, please change it to yours
        oMail.To.Add(new MailAddress("support@emailarchitect.net"));
        // Set email subject
        oMail.Subject = "test email from C# XAML project";
        // Set email body
        oMail.TextBody = "this is a test email sent from Windows Store App, do not reply";
        // Your SMTP server address
        SmtpServer oServer = new SmtpServer("smtp.emailarchitect.net");
        // User and password for ESMTP authentication            
        oServer.User = "test@emailarchitect.net";
        oServer.Password = "testpassword";
        // If your SMTP server requires TLS connection on 25 port, please add this line
        // oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
        // If your SMTP server requires SSL connection on 465 port, please add this line
        // oServer.Port = 465;
        // oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
        await oSmtp.SendMailAsync(oServer, oMail);
        Result = "Email was sent successfully!";
    }
    catch (Exception ep)
    {
        Result = String.Format("Failed to send email with the following error: {0}", ep.Message);
    }
    // Display Result by Diaglog box
    Windows.UI.Popups.MessageDialog dlg = new
        Windows.UI.Popups.MessageDialog(Result);
           
    await dlg.ShowAsync();
}
[C# - Send Email using Exchange WebDAV - Windows Store Apps - XAML]
using EASendMail;
using System.Threading.Tasks;
private async Task SendEmail()
{
    String Result = "";
    try
    {
        SmtpMail oMail = new SmtpMail("TryIt");
        SmtpClient oSmtp = new SmtpClient();
        // Set sender email address, please change it to yours 
        oMail.From = new MailAddress("test@emailarchitect.net");
        // Add recipient email address, please change it to yours
        oMail.To.Add(new MailAddress("support@emailarchitect.net"));
        // Set email subject
        oMail.Subject = "test email from C# XAML project";
        // Set email body
        oMail.TextBody = "this is a test email sent from Windows Store App, do not reply";
        // Your Exchange server address
        SmtpServer oServer = new SmtpServer("exch.emailarchitect.net");
        // Set Exchange WebDAV protocol - Exchange 2000/2003
        oServer.Protocol = ServerProtocol.ExchangeWebDav;
        //Exchange WebDAV authentication     
        oServer.User = "emailarchitect.net\\test";
        oServer.Password = "testpassword";
 
        // Set Drafts folder
        oServer.Drafts = "drafts";
        // If your Exchange WebDAV server requires SSL connection, please add this line
        // oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
        await oSmtp.SendMailAsync(oServer, oMail);
        Result = "Email was sent successfully!";
    }
    catch (Exception ep)
    {
        Result = String.Format("Failed to send email with the following error: {0}", ep.Message);
    }
    // Display Result by Diaglog box
    Windows.UI.Popups.MessageDialog dlg = new
        Windows.UI.Popups.MessageDialog(Result);
           
    await dlg.ShowAsync();
}
[C# - Send Email using Exchange Web Service - Windows Store Apps - XAML]
using EASendMail;
using System.Threading.Tasks;
private async Task SendEmail()
{
    String Result = "";
    try
    {
        SmtpMail oMail = new SmtpMail("TryIt");
        SmtpClient oSmtp = new SmtpClient();
        // Set sender email address, please change it to yours 
        oMail.From = new MailAddress("test@emailarchitect.net");
        // Add recipient email address, please change it to yours
        oMail.To.Add(new MailAddress("support@emailarchitect.net"));
        // Set email subject
        oMail.Subject = "test email from C# XAML project";
        // Set email body
        oMail.TextBody = "this is a test email sent from Windows Store App, do not reply";
        // Your Exchange server address
        SmtpServer oServer = new SmtpServer("exch.emailarchitect.net");
        // Set Exchange Web Service protocol - Exchange 2007/2010/2013
        oServer.Protocol = ServerProtocol.ExchangeEWS;
        //Exchange EWS authentication     
        oServer.User = "emailarchitect.net\\test";
        oServer.Password = "testpassword";
 
        // Exchange EWS service requires SSL connection by default
        oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
        await oSmtp.SendMailAsync(oServer, oMail);
        Result = "Email was sent successfully!";
    }
    catch (Exception ep)
    {
        Result = String.Format("Failed to send email with the following error: {0}", ep.Message);
    }
    // Display Result by Diaglog box
    Windows.UI.Popups.MessageDialog dlg = new
        Windows.UI.Popups.MessageDialog(Result);
           
    await dlg.ShowAsync();
}
[VB - Send Email using SMTP Protocol - Windows Store Apps - XAML]
Imports EASendMail
Private Async Function SendEmail() As Task
    Dim Result As String = ""
    Try
        Dim oMail As New SmtpMail("TryIt")
        Dim oSmtp As New SmtpClient()
        ' Set sender email address, please change it to yours
        oMail.From = New MailAddress("test@emailarchitect.net")
        ' Add recipient email address, please change it to yours
        oMail.To.Add(New MailAddress("support@emailarchitect.net"))
        ' Set email subject
        oMail.Subject = "test email from VB XAML project"
        ' Set email body
        oMail.TextBody = "this is a test email sent from Windows Store App, do not reply"
        ' Your SMTP server address
        Dim oServer As New SmtpServer("smtp.emailarchitect.net")
        ' User and password for ESMTP authentication            
        oServer.User = "test@emailarchitect.net"
        oServer.Password = "testpassword"
        ' If your SMTP server requires TLS connection on 25 port, please add this line
        ' oServer.ConnectType = SmtpConnectType.ConnectSSLAuto
        ' If your SMTP server requires SSL connection on 465 port, please add this line
        ' oServer.Port = 465
        ' oServer.ConnectType = SmtpConnectType.ConnectSSLAuto
        Await oSmtp.SendMailAsync(oServer, oMail)
        Result = "Email was sent successfully!"
    Catch ep As Exception
        Result = String.Format("Failed to send email with the following error: {0}", ep.Message)
    End Try
    ' Display Result by Diaglog box
    Dim dlg As New Windows.UI.Popups.MessageDialog(Result)
    Await dlg.ShowAsync()
End Function
[VB - Send Email using Exchange WebDAV - Windows Store Apps - XAML]
Imports EASendMail
Private Async Function SendEmail() As Task
    Dim Result As String = ""
    Try
        Dim oMail As New SmtpMail("TryIt")
        Dim oSmtp As New SmtpClient()
        ' Set sender email address, please change it to yours
        oMail.From = New MailAddress("test@emailarchitect.net")
        ' Add recipient email address, please change it to yours
        oMail.To.Add(New MailAddress("support@emailarchitect.net"))
        ' Set email subject
        oMail.Subject = "test email from VB XAML project"
        ' Set email body
        oMail.TextBody = "this is a test email sent from Windows Store App, do not reply"
        ' Your Exchange server address
        Dim oServer As New SmtpServer("exch.emailarchitect.net")
        ' Set Exchange WebDAV protocol - Exchange 2000/2003 
        oServer.Protocol = ServerProtocol.ExchangeWebDav
        
        ' Exchange User authentication        
        oServer.User = "emailarchitect.net\test"
        oServer.Password = "administratorpassword"
        ' set drafts folder name
        oServer.Drafts = "drafts"
        ' If Exchange WebDAV server requires SSL connection, please add this line
        ' oServer.ConnectType = SmtpConnectType.ConnectSSLAuto
        Await oSmtp.SendMailAsync(oServer, oMail)
        Result = "Email was sent successfully!"
    Catch ep As Exception
        Result = String.Format("Failed to send email with the following error: {0}", ep.Message)
    End Try
    ' Display Result by Diaglog box
    Dim dlg As New Windows.UI.Popups.MessageDialog(Result)
    Await dlg.ShowAsync()
End Function
[VB - Send Email using Exchange Web Service - Windows Store Apps - XAML]
Imports EASendMail
Private Async Function SendEmail() As Task
    Dim Result As String = ""
    Try
        Dim oMail As New SmtpMail("TryIt")
        Dim oSmtp As New SmtpClient()
        ' Set sender email address, please change it to yours
        oMail.From = New MailAddress("test@emailarchitect.net")
        ' Add recipient email address, please change it to yours
        oMail.To.Add(New MailAddress("support@emailarchitect.net"))
        ' Set email subject
        oMail.Subject = "test email from VB XAML project"
        ' Set email body
        oMail.TextBody = "this is a test email sent from Windows Store App, do not reply"
        ' Your Exchange server address
        Dim oServer As New SmtpServer("exch.emailarchitect.net")
        ' Set Exchange Web Service protocol - Exchange 2007/2010/2013 
        oServer.Protocol = ServerProtocol.ExchangeEWS
        
        ' Exchange User authentication        
        oServer.User = "emailarchitect.net\test"
        oServer.Password = "administratorpassword"
        ' Exchange EWS Service requires SSL connection by default
        oServer.ConnectType = SmtpConnectType.ConnectSSLAuto
        Await oSmtp.SendMailAsync(oServer, oMail)
        Result = "Email was sent successfully!"
    Catch ep As Exception
        Result = String.Format("Failed to send email with the following error: {0}", ep.Message)
    End Try
    ' Display Result by Diaglog box
    Dim dlg As New Windows.UI.Popups.MessageDialog(Result)
    Await dlg.ShowAsync()
End Function
[JavaScript - Send Email using SMTP Protocol - Windows Store Apps - HTML5]
function sendMail() {
    var result = "";
    var oMail = new EASendMail.SmtpMail("TryIt");
    var oSmtp = new EASendMail.SmtpClient();
    // Set sender email address, please change it to yours 
    oMail.from = new EASendMail.MailAddress("test@emailarchitect.net");
    // Add recipient email address, please change it to yours
    oMail.to.add(new EASendMail.MailAddress("support@emailarchitect.net"));
    // Set email subject
    oMail.subject = "test email from JavaScript HTML5 project";
    // Set email body
    oMail.textBody = "this is a test email sent from Windows Store App, do not reply";
    // Your SMTP server address
    var oServer = new EASendMail.SmtpServer("smtp.emailarchitect.net");
    // User and password for ESMTP authentication            
    oServer.user = "test@emailarchitect.net";
    oServer.password = "testpassword";
    // If your SMTP server requires TLS connection on 25 port, please add this line
    // oServer.connectType = EASendMail.SmtpConnectType.connectSSLAuto;
    // If your SMTP server requires SSL connection on 465 port, please add this line
    // oServer.port = 465;
    // oServer.connectType = EASendMail.SmtpConnectType.connectSSLAuto;
    oSmtp.sendMailAsync(oServer, oMail).then(function (e) {
        result = "Email was sent successfully!";
        // Display Result by Diaglog box
        (new Windows.UI.Popups.MessageDialog(result, "Success")).showAsync();
    },
    function (e) {
        // because javascript exception only gives the stack trace messages, but it is not
        // real description of exception, so we give a property lastErrorMessage for javascript.
        if (oSmtp.lastErrorMessage != "") {
            result = oSmtp.lastErrorMessage;
        }
        else {
            result = e.message;
        }
        oSmtp.close();
        // Display Result by Diaglog box
        (new Windows.UI.Popups.MessageDialog(result, "Error Information")).showAsync();
    });
}
[JavaScript - Send Email using Exchange WebDAV - Windows Store Apps - HTML5]
function sendMail() {
    var result = "";
    var oMail = new EASendMail.SmtpMail("TryIt");
    var oSmtp = new EASendMail.SmtpClient();
    // Set sender email address, please change it to yours 
    oMail.from = new EASendMail.MailAddress("test@emailarchitect.net");
    // Add recipient email address, please change it to yours
    oMail.to.add(new EASendMail.MailAddress("support@emailarchitect.net"));
    // Set email subject
    oMail.subject = "test email from JavaScript HTML5 project";
    // Set email body
    oMail.textBody = "this is a test email sent from Windows Store App, do not reply";
    // Your Exchange server address
    var oServer = new EASendMail.SmtpServer("exch.emailarchitect.net");
    // using Exchange WebDAV protocol
    oServer.protocol = EASendMail.ServerProtocol.exchangeWebDav
    
    // Exchange WebDAV authentication            
    oServer.user = "emailarchitect.net\\test";
    oServer.password = "testpassword";
    // set drafts folder name
    oServe.drafts = "drafts";
    // If your Exchange WebDAV server requires SSL connection, please add this line
    // oServer.connectType = EASendMail.SmtpConnectType.connectSSLAuto;
    oSmtp.sendMailAsync(oServer, oMail).then(function (e) {
        result = "Email was sent successfully!";
        // Display Result by Diaglog box
        (new Windows.UI.Popups.MessageDialog(result, "Success")).showAsync();
    },
    function (e) {
        // because javascript exception only gives the stack trace messages, but it is not
        // real description of exception, so we give a property lastErrorMessage for javascript.
        if (oSmtp.lastErrorMessage != "") {
            result = oSmtp.lastErrorMessage;
        }
        else {
            result = e.message;
        }
        oSmtp.close();
        // Display Result by Diaglog box
        (new Windows.UI.Popups.MessageDialog(result, "Error Information")).showAsync();
    });
}
[JavaScript - Send Email using Exchange Web Service - Windows Store Apps - HTML5]
function sendMail() {
    var result = "";
    var oMail = new EASendMail.SmtpMail("TryIt");
    var oSmtp = new EASendMail.SmtpClient();
    // Set sender email address, please change it to yours 
    oMail.from = new EASendMail.MailAddress("test@emailarchitect.net");
    // Add recipient email address, please change it to yours
    oMail.to.add(new EASendMail.MailAddress("support@emailarchitect.net"));
    // Set email subject
    oMail.subject = "test email from JavaScript HTML5 project";
    // Set email body
    oMail.textBody = "this is a test email sent from Windows Store App, do not reply";
    // Your Exchange server address
    var oServer = new EASendMail.SmtpServer("exch.emailarchitect.net");
    // Exchange Web Service authentication            
    oServer.user = "emailarchitect.net\\test";
    oServer.password = "testpassword";
    // using Exchange Web Service protocol - Exchange 2007/2010/2013
    oServer.protocol = EASendMail.ServerProtocol.exchangeEWS;
    // Exchange EWS Service requires SSL connection by default
    oServer.connectType = EASendMail.SmtpConnectType.connectSSLAuto;
    oSmtp.sendMailAsync(oServer, oMail).then(function (e) {
        result = "Email was sent successfully!";
        // Display Result by Diaglog box
        (new Windows.UI.Popups.MessageDialog(result, "Success")).showAsync();
    },
    function (e) {
        // because javascript exception only gives the stack trace messages, but it is not
        // real description of exception, so we give a property lastErrorMessage for javascript.
        if (oSmtp.lastErrorMessage != "") {
            result = oSmtp.lastErrorMessage;
        }
        else {
            result = e.message;
        }
        oSmtp.close();
        // Display Result by Diaglog box
        (new Windows.UI.Popups.MessageDialog(result, "Error Information")).showAsync();
    });
}
    See Also
        User Authentication and SSL Connection
        From, ReplyTo, Sender and Return-Path
        SmtpServer.Protocol Property