AuthType Property

This property specifies the type of ESMTP authenction.


Data Type: Long

Value Meaning
-1 Automatically
0 (Default) AUTH LOGIN
1 AUTH NTLM(Secure Password Authentication)
2 AUTH CRAM-MD5
3 AUTH PLAIN
4 AUTH MSN


Remarks

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

So far only Microsoft Exchange Server supports Secure Password Authentication.

Usage Example:

[Visual Basic]
Private Sub SendEmail()
  Dim oSmtp As AOSMTPLib.Mail
  Set oSmtp = New AOSMTPLib.Mail

  oSmtp.ServerAddr = "mail.adminsystem.net"
  oSmtp.FromAddr = "test@adminsystem.net"
  oSmtp.AddRecipient "Support Team", "support@adminsystem.net", 0

  oSmtp.AuthType = 1
  oSmtp.UserName = "test@adminsystem.net"
  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
[C#]
private void SendEmail()
{
  AOSMTPLib.MailClass oSmtp = new AOSMTPLib.MailClass();
  oSmtp.ServerAddr = "mail.adminsystem.net";
  oSmtp.FromAddr = "test@adminsystem.net";
  oSmtp.AddRecipient( "Support Team", "support@adminsystem.net", 0 );

  oSmtp.AuthType = 0;
  oSmtp.UserName = "test@adminsystem.net";
  oSmtp.Password = "test";
  
  oSmtp.BodyText = "Hello, this is a test....";
  if( oSmtp.SendMail() == 0 )
    Console.WriteLine( "Message delivered!" );
  else
    Console.WriteLine( oSmtp.GetLastErrDescription());
}
[Visual C++]
#include "stdafx.h"
#include <comdef.h>
#include <iostream>
#import "C:\Program Files\AdminSystem.NET\ANSMTP\AOSMTP.dll" \
                                  rename_namespace("AOSMTPLib")
using namespace AOSMTPLib;
using namespace std;

void SendEmail()
{
  ::CoInitialize( NULL );
  IMailPtr oSmtp = NULL;
  oSmtp.CreateInstance("AOSMTP.Mail");
	
  oSmtp->ServerAddr = _bstr_t( "mail.adminsystem.net" );
  oSmtp->FromAddr = _bstr_t( "test@adminsystem.net" );
  oSmtp->AddRecipient( _bstr_t("Support Team"), 
                          _bstr_t("support@adminsystem.net"), 0 );

  oSmtp->>AuthType = 3;
  oSmtp->UserName = _bstr_t("test@adminsystem.net");
  oSmtp->Password = _bstr_t("test");
  
  oSmtp->BodyText = _bstr_t("Hello, this is a test....");
  if( oSmtp->SendMail() == 0 )
    cout << "Message delivered!" << endl;
  else
    cout << (const char*)(oSmtp->GetLastErrDescription()) << endl;
}

See Also

UserName Property
Password Property


2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.