AuthType Property


This property specifies the type of ESMTP/SMTP user authentication mechanism.

Data Type: Long

Value Meaning
-1 (Default) EASendMail detects the SMTP authentication mechanism automatically, we strongly recommend using the default value.
0 AUTH LOGIN
1 AUTH NTLM(Secure Password Authentication)
2 AUTH CRAM-MD5
3 AUTH PLAIN
4 AUTH MSN
5 XOAUTH2

Remarks

If you didn't specify UserName and Password properties, AuthType property is meaningless.

Only Microsoft Exchange Server supports Secure Password Authentication(NTLM).

XOAUTH2 is used for Gmail OAUTH, please use Gmail OAUTH access_token as the password. For more detail, please refer to Using Gmail SMTP OAUTH section.

Example

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

[VB, VBA - SMTP User Authentication]
Private Sub SendEmail()
  Dim oSmtp As EASendMailObjLib.Mail
  Set oSmtp = New EASendMailObjLib.Mail
 
  oSmtp.LicenseCode = "TryIt"
  oSmtp.ServerAddr = "mail.adminsystem.com"
  oSmtp.FromAddr = "test@adminsystem.com"
  oSmtp.AddRecipient "Support Team", "support@adminsystem.com", 0
 
  oSmtp.UserName = "test@adminsystem.com"
  oSmtp.Password = "test"
  
  oSmtp.BodyText = "Hello, this is a test...."
  If oSmtp.SendMail() = 0 Then
    MsgBox "Message delivered!"
  Else
    MsgBox oSmtp.GetLastErrDescription()
  End If
End Sub

[VBScript, ASP - SMTP User Authentication]
  Dim oSmtp
  Set oSmtp = Server.CreateObject("EASendMailObj.Mail")
 
  oSmtp.LicenseCode = "TryIt"
  oSmtp.ServerAddr = "mail.adminsystem.com"
  oSmtp.FromAddr = "test@adminsystem.com"
  oSmtp.AddRecipient "Support Team", "support@adminsystem.com", 0
 
  oSmtp.UserName = "test@adminsystem.com"
  oSmtp.Password = "test"
  
  oSmtp.BodyText = "Hello, this is a test...."
  If oSmtp.SendMail() = 0 Then
    Response.Write "Message delivered!"
  Else
    Response.Write oSmtp.GetLastErrDescription()
  End If
 
[Visual C++ - SMTP User Authentication]
#include "stdafx.h"
#include <comdef.h>
#include <iostream>
 
#include "easendmailobj.tlh"
using namespace EASendMailObjLib;
using namespace std;
 
void SendEmail()
{
  ::CoInitialize( NULL );
  IMailPtr oSmtp = NULL;
  oSmtp.CreateInstance(__uuidof(EASendMailObjLib::Mail));
  oSmtp->LicenseCode = _T("TryIt");
	
  oSmtp->ServerAddr = _T( "mail.adminsystem.com" );
  oSmtp->FromAddr = _T( "test@adminsystem.com" );
  oSmtp->AddRecipient( _T("Support Team"), 
                          _T("support@adminsystem.com"), 0 );
 
  oSmtp->UserName = _T("test@adminsystem.com");
  oSmtp->Password = _T("test");
  
  oSmtp->BodyText = _T("Hello, this is a test....");
  if( oSmtp->SendMail() == 0 )
    cout << "Message delivered!" << endl;
  else
    cout << (const TCHAR*)(oSmtp->GetLastErrDescription()) << endl;
}

[Delphi - SMTP User Authentication]
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 SMTP server address
  oSmtp.ServerAddr := 'smtp.emailarchitect.net';

  // User and password for ESMTP authentication, if your server doesn't require
  // user authentication, please remove the following codes
  oSmtp.UserName := 'test@emailarchitect.net';
  oSmtp.Password := 'testpassword';

  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.

See Also

User Authentication and SSL Connection
UserName Property
Password Property