wodImapServer ActiveX Component - CreateMessage Event
    
 

Description

Fires when user wants to create new message.


Syntax

Private Sub object_CreateMessage(User, Folder, Message, Action)



The CreateMessage Event syntax has these parts:

Part Description
object A wodImapServer object.
User An ImapUser object. Reference to user who wants to create new message.
Folder An ImapFolder object. Reference to folder where new message should be created.
Message An ImapMessage object. Reference to new pre-created message.
Action An ImapActions enumeration, as described in settings. Return value you should fill with either Allow or Deny value, depending if you will allow message to be created or not.

Settings

The settings for Action are:

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

Remarks
This event does not apply or fire when you Add messages to the folder. It is fired only when user actions lead to necessity of creating new message. Typical reason for this could be when user wants to copy some message from external source to your IMAP server. For example, Outlook express allows users to drag EML files to specific folder and drop it there - in which case you should create new message and user will paste contents to it.

Before this event is fired, wodImapServer will create new message and give you reference to it through Message parameter. If you Deny this Action, then it will be removed from the collection immediately after you exit this event.

But - if you decide to allow message to be created, you should check if proper Message.UID is set, set Message.Filename and set proper Flags (or just remove all flags). Later on, when wodImapServer wants to write actual body to this message, it will fire WriteMessage event informing you to update message contents on your storage device. If you already put valid Filename for the message - you can just ignore WriteMessage event.