Alias Property


Sets another user alias used in Exchange WebDAV protocol.

Data Type: String

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.

Examples

[VB, VC++, Delphi] To get the full samples of EASendMail, please refer to Samples section.

[VB6, VBA - Send Email with Exchange Server WebDAV]
Private Sub Send_Email_Exchange_WebDav()
    
    Dim oSmtp As New EASendMailObjLib.Mail
    oSmtp.LicenseCode = "TryIt"
    
    ' 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"
    
    ' Your Exchange server address
    oSmtp.ServerAddr = "exch.emailarchitect.net"
    
    ' Set Exchange WebDav Protocol - Exchange 2000/2003
    oSmtp.Protocol = 2

    ' Use administrator to do Exchange WebDav authentication
    oSmtp.UserName = "emailarchitect.net\administrator"
    oSmtp.Password = "administratorpassword"

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


    ' If your WebDav requires SSL connection, please add this line
    ' oSmtp.SSL_init
    
    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

[Delphi - Send Email with Exchange Server WebDAV]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, EASendMailObjLib_TLB; // add EASendMail unit

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  oSmtp : TMail;
begin
  oSmtp := TMail.Create(Application);
  oSmtp.LicenseCode := 'TryIt';

  // 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 Delphi project';

  // Set email body
  oSmtp.BodyText := 'this is a test email sent from Delphi project, do not reply';

  // Your Exchange server address
  oSmtp.ServerAddr := 'exch.emailarchitect.net';

  // Set Exchange WebDAV - Exchange 2000/2003
  oSmtp.Protocol := 2;

  // User and password for Exchange user authentication
  oSmtp.UserName := 'test';
  oSmtp.Password := 'testpassword';

  // If your WebDAV requires SSL, please add this line
  // oSmtp.SSL_init();

  ShowMessage( 'start to send email ...' );

  if oSmtp.SendMail() = 0 then
    ShowMessage( 'email was sent successfully!' )
  else
    ShowMessage( 'failed to send email with the following error: '
    + oSmtp.GetLastErrDescription());

end;

end.
            
[Visual C++ - Send Email with Exchange Server WebDAV]
#include "stdafx.h"

#include "easendmailobj.tlh"
using namespace EASendMailObjLib;

int _tmain(int argc, _TCHAR* argv[])
{
    ::CoInitialize( NULL );

    IMailPtr oSmtp = NULL;
    oSmtp.CreateInstance( __uuidof(EASendMailObjLib::Mail));
    oSmtp->LicenseCode = _T("TryIt");
    
    // Set your sender email address
    oSmtp->FromAddr = _T("test@emailarchitect.net");
    
    // Add recipient email address
    oSmtp->AddRecipientEx( _T("support@emailarchitect.net"), 0 );
    
    // Set email subject
    oSmtp->Subject = _T("simple email from Visual C++ project");
    
    // Set email body
    oSmtp->BodyText = _T("this is a test email sent from Visual C++ project, do not reply");
    
    // Your Exchange server address
    oSmtp->ServerAddr = _T("exch.emailarchitect.net");
    
    // Set Exchange WebDAV protocol - Exchange Server 2000/2003
    oSmtp->Protocol = 2;

    // User and password for Exchange user authentication
    oSmtp->UserName = _T("test");
    oSmtp->Password = _T("testpassword");

    // If your WebDAV requires SSL connection, please add this line
    // oSmtp->SSL_init();

    _tprintf(_T("Start to send email ...\r\n" ));
  
    if( oSmtp->SendMail() == 0 )
    {
        _tprintf( _T("email was sent successfully!\r\n"));
    }
    else
    {
        _tprintf( _T("failed to send email with the following error: %s\r\n"),
            (const TCHAR*)oSmtp->GetLastErrDescription());
    }

    if( oSmtp != NULL )
        oSmtp.Release();

    return 0;
}
                     

Online Tutorial

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

Protocol Property
Drafts Property