SmtpServer.Drafts Property


Sets the drafts folder name used in Exchange WebDAV protocol.

[Visual Basic]
Public Property Drafts As String
[C#]
public string Drafts {get; set;}
[C++]
public: __property String^ get_Drafts();
public: __property void set_Drafts(String^);
[JScript]
public function get Drafts() : String;
public function set Drafts(String);

Property Value

A string value indicating the drafts name for Exchange WebDAV.

Remarks

If you choose Exchange WebDAV protocol, you need to input your "Drafts" mail folder name here. Default name is "Drafts", but if your default language is not English in Exchange Server, your drafts name will be another name in your language. For example, if your default language is Chinese, your drafts name is "草稿", then you should input your drafts name here.
For SMTP and Exchange Web Service protocol, you can simply ignore this property.

Example

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

[Visual Basic - Send Email with Exchange WebDAV]
Imports EASendMail
Sub SendMail_Exchange_WebDav()
    Dim oMail As New SmtpMail("TryIt")
    Dim oSmtp As New SmtpClient()

    ' Set sender email address, please change it to yours
    oMail.From = "test@emailarchitect.net"

    ' Set recipient email address, please change it to yours
    oMail.To = "support@emailarchitect.net"
        
    ' Set email subject
    oMail.Subject = "test email from VB.NET project"
        
    ' Set email body
    oMail.TextBody = "this is a test email sent from VB.NET project, do not reply"

    ' Your Exchange server address
    Dim oServer As New SmtpServer("exch.emailarchitect.net")

    ' Set Exchange WebDav protocol (EWS) - Exchange 2000/2003 
    oServer.Protocol = ServerProtocol.ExchangeWebDav
        
    ' Use administrator to do  Exchange User authentication        
    oServer.User = "administrator"
    oServer.Password = "administratorpassword"

    ' Use test user mail folder to send email
    oServer.Alias = "test"

    ' If Exchange WebDav requires SSL connection, please add this line
    ' oServer.ConnectType = SmtpConnectType.ConnectSSLAuto
    
    ' Set your Drafts folder name
    oServer.Drafts = "drafts"

    Try

        Console.WriteLine("start to send email ...")
        oSmtp.SendMail(oServer, oMail)
        Console.WriteLine("email was sent successfully!")

    Catch ep As Exception

        Console.WriteLine("failed to send email with the following error:")
        Console.WriteLine(ep.Message)
    End Try

End Sub

[C# - Send Email using Exchange WebDAV]
using System;
using EASendMail;
void SendMail_Exchange_WebDAV()
{
    SmtpMail oMail = new SmtpMail("TryIt");
    SmtpClient oSmtp = new SmtpClient();
        
    // Set sender email address, please change it to yours
    oMail.From = "test@emailarchitect.net";

    // Set recipient email address, please change it to yours
    oMail.To = "support@emailarchitect.net";
            
    // Set email subject
    oMail.Subject = "test email from c# project";
            
    // Set email body
    oMail.TextBody = "this is a test email sent from c# project, do not reply";
 
    // Your Exchange server address
    SmtpServer oServer = new SmtpServer("exch.emailarchitect.net");

    // Set Exchange WebDav protocol (EWS) - Exchange 2000/2003
    oServer.Protocol = ServerProtocol.ExchangeWebDav;

    // Use administrator to do Exchange authentication     
    oServer.User = "administrator";
    oServer.Password = "administrator password";
 
    // Use test user mail folder to send email
    oServer.Alias = "test";

    // If your Exchange WebDav requires SSL connection, please add this line
    // oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
 
    // Set your Drafts folder name
    oServer.Drafts = "drafts";

    try
    {
        Console.WriteLine("start to send email ...");
        oSmtp.SendMail(oServer, oMail);
        Console.WriteLine("email was sent successfully!");
    }
    catch (Exception ep)
    {
        Console.WriteLine("failed to send email with the following error:");
        Console.WriteLine(ep.Message);
    }
}


[C++ - Send Email using Exchange WebDAV]
using namespace System;
using namespace EASendMail;
void SendMail_Exchange_WebDav()
{
    SmtpMail ^oMail = gcnew SmtpMail("TryIt");
    SmtpClient ^oSmtp = gcnew SmtpClient();

    // Set sender email address, please change it to yours
    oMail->From = "test@emailarchitect.net";

    // Set recipient email address, please change it to yours
    oMail->To = "support@emailarchitect.net";
    
    // Set email subject
    oMail->Subject = "test email from Managed C++ project";
    
    // Set email body
    oMail->TextBody = "this is a test email sent from Managed C++ project, do not reply";

    // Your Exchange server address
    SmtpServer ^oServer = gcnew SmtpServer("exch.emailarchitect.net");

    // Set Exchange WebDav Protocol - Exchange 2000/2003
    oServer->Protocol = ServerProtocol::ExchangeWebDav;

    // Use administrator user to do Exchange WebDav authentication
    oServer->User = "administrator";
    oServer->Password = "administrator password";

    // Use test user mail folder to send email
    oServer->Alias = "test";

    // If your WebDav service requires SSL connection, please add this line
    oServer->ConnectType = SmtpConnectType::ConnectSSLAuto;

    // Set your Drafts folder name
    oServer->Drafts = "drafts";

    try
    {
        Console::WriteLine("start to send email from Managed C++...");
        oSmtp->SendMail(oServer, oMail);
        Console::WriteLine("email was sent successfully!");
    }
    catch (Exception ^ep)
    {
        Console::WriteLine("failed to send email with the following error:");
        Console::WriteLine(ep->Message);
    }
}

See Also

SmtpServer.Protocol Property
SmtpServer.Drafts Property
User Authentication and SSL Connection
Process Bounced Email (Non-Delivery Report) and Email Tracking

Online Tutorial

Send Email using Exchange WebDAV in C#
Send Email using Exchange WebDAV in VB

Send Email using Exchange Web Service in C#
Send Email using Exchange Web Service in VB