Authenticate Method  
 

Authenticate the client session.

Syntax

object.Authenticate( [UserName], [Password] )

Parameters

UserName
An optional string argument which specifies the username used to authenticate the client session. If the argument is omitted, the value assigned to the UserName property will be used instead.
Password
An optional string argument which specifies the password used to authenticate the client session. If the argument is omitted, the value assigned to the Password property will be used instead. If you are using OAuth 2.0 authentication, this parameter specifies the bearer token provided by the mail service.

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

Remarks

The Authenticate method is used to authenticate the current client session to the mail server, ensuring that only valid users may deliver messages through the server. This method uses the LOGIN authentication mechanism by default and you can specify an alternate authentication method by setting the the AuthType property.

Authentication requires the server to support the AUTH extended SMTP command and the Extended property must be set to True. If the server does not support the specified type of authentication, an error will be returned.

If you with to use OAuth 2.0 for authentication, set the AuthType property to the desired authentication type prior to calling this method. The connection must be secure, and the server must advertise its support for OAuth 2.0 or the authentication attempt will fail. This method will not attempt to automatically refresh an expired token.

See Also

AuthType Property, BearerToken Property, Password Property, UserName Property, Connect Method