wodImapServer ActiveX Component - Connected Event
    
 

Description

Fires when user successfully connects to Imap server.


Syntax

Private Sub object_Connected(User, Username, Password, Action)



The Connected Event syntax has these parts:

Part Description
object A wodImapServer object.
User An ImapUser object. Reference to user that wants to login to your IMAP server.
Username A String value. String expression that holds provided username.
Password A String value. String expression that holds provided password.
Action An ImapActions enumeration, as described in settings. Return value you should set to either Allow or Deny to determine if login will be successful.

Settings

The settings for Action are:

Constant Value Description
 Deny 0 Deny execution of the action.
 Allow 1 Allow to execute action.

Remarks
Connected event is fired when your application (or you) needs to decide if it will allow user to login or not. For this purpose, user will send his username/password combination you should check here (from your local database, for instance) and return Allow or Deny constant value using Action parameter. By default, Action parameter will be set to Deny so if there are any problems with your application, no user is able to login and cause damage to your server.

Typical scenario would be like this:
 
If User.Username = "joe" And Password = "joe" Then
   Action = Allow
Else
   Action = Deny
End If
 
Above code is pretty obvious. If username/password combination is joe/joe then user will be able to access his mailboxes. If not, he is rejected from the server with error.

You don't have to do anything else in this event (such as checking for folders or messages). Respective events exists and will be fired later on (and that's the place where you will have to act). This event is only for checking if you will allow user to login or not.

NOTE: In DEMO version you cannot set Action = Deny, everyone can login!