AuthMethod Property


MailBee.IMAP4 object can establish connection with the IMAP4 server using various authentication types.

Default setting is a regular authentication. Most IMAP4 servers support it, but it is insecure if the connection itself is not secure. During regular authentication user password is sent to server in a plain-text form, so the password can be intercepted by a malicious person. In case if the connection is protected with SSL/TLS, this is not a problem.

However, MailBee also supports secure authentication methods and OAuth 2.0. All you need for using a secure connection is to set AuthMethod property value prior to connecting.

With OAuth 2.0, you need to have an access token which can be obtained from the mail service provider (this mechanism is unique for each particular provider). They can offer software libraries or other guidelines on how can get access tokens for their service. MailBee Objects ships with VBScript OAuth 2.0 sample for Gmail. You can find it in My Documents/MailBee Objects/Samples/OAuth2_VBScript folder.

Also, MailBee supports Integrated Windows Authentication (IWA) so you can use any of NTLM or GSSAPI methods specifying empty username. In this case, MailBee will automatically obtain the current user credentials from the operating system. This is widely used with Microsoft services like MS Exchange Server or IIS.

AuthMethod property must be set BEFORE calling Connect method, otherwise it will not take effect.

The following authentication method are allowed:

UserDomain property is not used with regular or CRAM-MD5 authentication. TargetName is only used with GSSAPI/Kerberos.

Note: Particular IMAP4 server might not support some authentication types.


Value Type: Long
Parameters: None 

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.ServerName = "mailserver.com"
Mailer.UserName = "MyName"
Mailer.Password = "MyPassword"
Mailer.AuthMethod = 1 ' Using CRAM-MD5 secure authentication
Mailer.Connect
If Mailer.Connected Then
  MsgBox "Connected using CRAM-MD5 secure authentication"
  Mailer.Disconnect
End If

See Also:

Connect Method


Copyright © 2002-2022, AfterLogic Corporation. All rights reserved.