AuthMethod Property


Specifies the method to authenticate the mail sender on the SMTP server.

By default, SMTP authentication is not used but most servers nowadays require it so you'll probably need to enable it.

The following authentication methods are allowed:

IWA is an Integrated Windows Authentication (lets you authenticate against a server using the credentials of the currently logged Windows user, no login and password is required).


If your mail server requires users to authenticate themselves, enable SMTP authentication by setting AuthMethod, UserName, Password property values before calling Connect or Send methods.


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.

Note: Some servers (usually in local networks) do not require and even do not support any kind of SMTP authentication.


Value Type: Long
Parameters: None 

Usage example:

Dim Mailer

' Using Visual Basic to create object
Set Mailer = CreateObject("MailBee.SMTP")

' Using ASP to create object
' Set Mailer = Server.CreateObject("MailBee.SMTP")
'
' In ASP, use Response.Write instead of MsgBox

' Unlock SMTP component
Mailer.LicenseKey = "put your license key here"

' Specify SMTP server name
Mailer.ServerName = "mail.server.com"

' Use LOGIN authentication method
Mailer.AuthMethod = 2
Mailer.UserName = "johndoe"
Mailer.Password = "secret"

Mailer.Message.ToAddr = "bill@yoursite.com"
Mailer.Message.FromAddr = "joe@mysite.com"
Mailer.Message.Subject = "Hello"
Mailer.Message.BodyText = "The message body"

' Try to send message
If Mailer.Send Then
  MsgBox "Sent successfully"
Else
  ' Notify user about error
  MsgBox "Error #" & Mailer.ErrCode 
End If

' Close the connection
Mailer.Disconnect

See Also:

Connect Method
Domain Property
Password Property
UserName Property


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