SmtpServer.Alias Property


Sets another user alias used in Exchange WebDAV protocol.

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

Property Value

A string value indicating the user alias for Exchange WebDAV.

Remarks

If you choose Exchange WebDAV protocol, EASendMail need to create and send email by a user mail folder. By default, the authenticated user mail folder is used. You can use this property to specify another user mail folder to be used, but your authenticated user MUST have the permission to access this user alias folder. This property is not recommended to be used.
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()

    Try
        Dim oMail As New SmtpMail("TryIt")
        ' 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 - Exchange 2000/2003 
        oServer.Protocol = ServerProtocol.ExchangeWebDav
        ' If Exchange WebDav requires SSL connection, please add this line
        ' oServer.ConnectType = SmtpConnectType.ConnectSSLAuto

        ' Use administrator to do  Exchange User authentication        
        oServer.User = "administrator"
        oServer.Password = "administratorpassword"

        ' Use test user mail folder to send email
        oServer.Alias = "test"
        ' Set your Drafts folder name
        oServer.Drafts = "drafts"

        Console.WriteLine("start to send email ...")

        Dim oSmtp As New SmtpClient()
        oSmtp.SendMail(oServer, oMail)
        Console.WriteLine("This email has been submitted to server successfully!")

    Catch ep As Exception
        Console.WriteLine("failed to send email: {0}", ep.Message)
    End Try

End Sub


[C# - Send Email using Exchange WebDAV] using System; using EASendMail; void SendMail_Exchange_WebDAV() { try { SmtpMail oMail = new SmtpMail("TryIt"); // 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 - Exchange 2000/2003 oServer.Protocol = ServerProtocol.ExchangeWebDav; // If your Exchange WebDav requires SSL connection, please add this line // oServer.ConnectType = SmtpConnectType.ConnectSSLAuto; // Use administrator to do Exchange authentication oServer.User = "administrator"; oServer.Password = "administrator password"; // Use test user mail folder to send email oServer.Alias = "test"; // Set your Drafts folder name oServer.Drafts = "drafts"; Console.WriteLine("start to send email ..."); SmtpClient oSmtp = new SmtpClient(); oSmtp.SendMail(oServer, oMail); Console.WriteLine("This email has been submitted to server successfully!"); } catch (Exception ep) { Console.WriteLine("failed to send email: {0}", ep.Message); } }
[C++ - Send Email using Exchange WebDAV] using namespace System; using namespace EASendMail; void SendMail_Exchange_WebDav() { try { SmtpMail ^oMail = gcnew SmtpMail("TryIt"); // 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; // If your WebDav service requires SSL connection, please add this line // oServer->ConnectType = SmtpConnectType::ConnectSSLAuto; // 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"; // Set your Drafts folder name oServer->Drafts = "drafts"; Console::WriteLine("start to send email from Managed C++..."); SmtpClient ^oSmtp = gcnew SmtpClient(); oSmtp->SendMail(oServer, oMail); Console::WriteLine("This email has been submitted to server successfully!"); } catch (Exception ^ep) { Console::WriteLine("failed to send email: {0}", 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