wodImapServer ActiveX Component - Connected Method
      
 

Description

Called when user successfully connects to Imap server.


Return Type

None  


Syntax

object.Connected Owner, User, Username, Password, Action



The Connected Method syntax has these parts:

Part Description
object An expression evaluating to an object of type IwodImapNotify.
Owner Required. A wodImapServer object.
User Required. An ImapUser object. Reference to user that wants to login to your IMAP server.
Username Required. A String value. String expression that holds provided username.
Password Required. A String value. String expression that holds provided password.
Action Required. 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
NOTE: This method is called only if you implemented IwodImapNotify interface in your application, and wodImapServer1.Notification property has received reference to instance of your implementation.
 
Connected notification method is called 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 notification method (such as checking for folders or messages). Respective notification method also exists and will be called later on (and that's the place where you will have to act). This notification method 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!