|
||||||||||||||||||||||||||||||||||||||||||||
|
Reference WorkgroupMail API The WorkgroupMail API provides programmatic control over some of the features in WorkgroupMail. Most of the objects and methods relate to the administration of WorkgroupMail, however there are also specific methods for creating and sending messages programmatically via WorkgroupMail. The WorkgroupMail API is made up of the following automation objects.
WMSessionWMSession is the object that represents a login session with WorkgroupMail. The caller must log on to a session, either as an administrator, or as a user, before being permitted to perform most other operations. The WMSession object is the only object that needs to be explicitly created. All other objects may be accessed from this object. The following code is an example of how to create a WMSession object in Visual Basic: Set session = CreateObject("WMAPI.WMSession") bSuccess = session.Login(“adminpassword”) Properties LocalPOP3LoginName Description: The local POP3 login name for the workgroup. This is the login name for an account which exposes all the messages held in WorkgroupMail for download. Type: String LocalPOP3Password Description: The local POP3 password for the workgroup. This is the password for an account which exposes all the messages held in WorkgroupMail for download. Type: String UnknownRedirectUser Description The WMUser object that unknown mail is forwarded to. Type: WMUser object WorkgroupName Description: The Company Name as entered with the keycode. This is used only to verify the keycode. Type: String Administrator Description: The WMUser object that is the administrator of the workgroup. This is the first user that was created when WorkgroupMail was installed. Type: WMUser object LogCommunications Description: Specifies whether or not all SMTP, POP3 and IMAP communications should be logged to a file. Type: Boolean LogFile Description: The full path and name of the file used to log all SMTP, POP3 and IMAP communications. Type: String ClientConnectionInterface Description: The interface that the POP3 server listens on, for client connections. It takes the form of an IP address in dot notation . It must match one of the local IP addresses of the computer, which runs WorkgroupMail. Type: String ServerConnectionInterface Description: The interface that the SMTP server listens on, for client connections (or other mail servers). It takes the form of an IP address in dot notation. It must match one of the local IP addresses of the computer, which runs WorkgroupMail. Type: String IMAPConnectionInterface Description: The interface that the IMAP server listens on, for client connections (or other mail servers). It takes the form of an IP address in dot notation. It must match one of the local IP addresses of the computer, which runs WorkgroupMail. Type: String PurgeEventLogPeriodically Description: Specifies if WorkgroupMail should periodically purge entries from the event log. This represents the corresponding UI settings in the Purging page of the Settings property sheet. Type: Boolean PurgeEventsAge Description: The age, in days, that event log entries need to be before they are purged. This represents the corresponding UI settings in the Purging page of the Settings property sheet. Type: Long Integer DontDownloadLargeMessages Description: Specifies if large messages are to be left on the server when downloading mail from ISPs. Represents the corresponding UI settings in the Advanced page of the Settings property sheet. Type: Boolean LargeMessageSize Description: The size, in bytes, of the largest message that may be downloaded. Represents the corresponding UI settings in the Advanced page of the Settings property sheet. Type: Long Integer OpenRelay Description: Sets or gets the open relay property of WorkgroupMail. Returns True if WorkgroupMail is configured as an open relay. Allows the caller to configure WorkgroupMail as an open relay. Type: Boolean RelayAuthenticated Description: Specifies if mail can be relayed using SMTP authentication. This option is ignored if OpenRelay is true. If this property is true then, if the local sender has authenticated themselves, using SMTP authentication, they will automatically be permitted to relay mail to addresses outside the domain. Type: Boolean AQLimitStoredMessages Description: A boolean that specifies if a default limit will be imposed on the maximum number of messages allowed in a user account mailbox. User account quotas will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Quotas page of the Settings property sheet. Type: Boolean AQStoredMessageLimit Description: The default account quota for the maximum number of messages that can be stored in a user account mailbox. Dependant on AQLimtStoredMessages being true. User account quotas will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Quotas page of the Settings property sheet. Type: Long Integer AQLimitStorageSize Description: A global boolean setting that specifies if a limit will be imposed on the maximum amount of disk space that can be occupied by messages in a user account mailbox. User account quotas will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Quotas page of the Settings property sheet. Type: Boolean AQStorageSizeLimit Description: The default account quota, in KB, for the maximum amount of disk space that can be occupied by messages in a user account mailbox. Dependant on AQLimtStorageSize being true. User account quotas will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Quotas page of the Settings property sheet. Type: Long Integer APAutoDeleteInactiveAccount Description: A global boolean setting that specifies if inactive accounts will be deleted automatically. Specific user account pruning will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Pruning page of the Settings property sheet. Type: Boolean APInactiveDays Description: The default number of days that an account has to be inactive before it is automatically deleted . Dependent on APAutoDeleteInactiveAccount being true. Specific user account pruning will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Pruning page of the Settings property sheet. Type: Long Integer APDeleteInboxMessages Description: A global boolean setting that specifies if old messages in the inbox will be purged. The Inbox is where WorkgroupMail initially delivers new messages for a particular user. Specific user account pruning will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Pruning page of the Settings property sheet. Type: Boolean APDeleteInboxMessageDays Description: The default number of days old that a message must be before it is automatically purged from the Inbox. Dependent on APDeleteInboxMessages being true. Specific user account pruning will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Pruning page of the Settings property sheet. Type: Long Integer APDeletePersonalFolderMessages Description: A global boolean setting that specifies if old messages in any personal folders will be purged. Personal folders are folders that are created in WebMail or using an IMAP client. Specific user account pruning will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Pruning page of the Settings property sheet. Type: Boolean APDeletePFMessageDays Description: The default number of days old that a message must be before it is automatically purged from any personal folder. Dependent on APDeleteInboxMessages being true. Specific user account pruning will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Pruning page of the Settings property sheet. Type: Long Integer APDeleteDeletedMessages Description: A global boolean setting that specifies if deleted messages will be purged. Deleted messages are messages that exist in the Deleted Items folder. Specific user account pruning will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Pruning page of the Settings property sheet. Type: Boolean APDeleteDeletedMessageDays Description: The default number of days old that a deleted message must be before it is automatically purged from an account. Dependent on APDeleteDeletedMessages being true. Specific user account pruning will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Pruning page of the Settings property sheet. Type: Long Integer ARCanUseWebMail Description: A global boolean setting that specifies whether or not a user can use WebMail. Specific user account restrictions will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Restrictions page of the Settings property sheet. Type: Boolean ARCanUseIMAP Description: A global boolean setting that specifies whether or not a user can use IMAP. Specific user account restrictions will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Restrictions page of the Settings property sheet. Type: Boolean ARCanSendExternalMessages Description: A global boolean setting that specifies whether or not a user can send external mail. If false, the exceptions list will prevail. Specific user account restrictions will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Restrictions page of the Settings property sheet. Type: Boolean ARCanReceiveExternalMessages Description: A global boolean setting that specifies whether or not a user can receive external mail. If false, the exceptions list will prevail. Specific user account restrictions will override this setting. This setting only applies to the Enterprise edition. It represents the corresponding user interface settings in the Account Restrictions page of the Settings property sheet. Type: Boolean SpamFilterType Description: Specifies the action to perform on detection of a spam message. This corresponds to the user interface in the Settings page of the Spam Filtering property sheet. The following values are valid. 0. Do nothing 1. Filter spam and place in specified quarantine 2. Filter spam and delete/reject messages. 3. Add a header to the message for subsequent detection in the content filter (if appropriate). Type: Short integer SpamFilterDefaultMessageType Description: Sets or gets how WorkgroupMail should treat messages in terms of spam mail. The following values are valid. 0. No junk mail filtering 1. Treat all mail as junk mail except for white list. 2. Treat all mail as non-junk unless specifically identified as such by the black list, the spam servers or SpamCleanser. Type: Short integer SpamQuarantine Description: Sets or gets the quarantine area that is used to hold messages that are detected as spam messages. Type: WMQuarantineArea object SMTPServerPort Description: Sets or gets the port used for listening for incoming SMTP connections. This corresponds to the user interface in the Advanced page of the Settings property sheet. Type: Short integer POP3ServerPort Description: Sets or gets the port used for listening for incoming POP3 connections. This corresponds to the user interface in the Advanced page of the Settings property sheet. Type: Short integer IMAPServerPort Description: Sets or gets the port used for listening for incoming IMAP connections. This corresponds to the user interface in the Advanced page of the Settings property sheet. Type: Short integer DefaultOutOfOfficeReply Description: Sets or gets the global out of office reply. This setting can be overridden on a per-user basis. Type: String Methods Login Description: Logs into the WorkgroupMail session. Most operations cannot be performed unless this function has successfully been called. The administrator password may be changed once successfully logged in. Syntax: Login (sPassword as string) Parameters: sPassword is the administrator password. Return type: Boolean Example: bLoggedIn = session.Login("AdminPwd") Logout Description: Log out of the WorkgroupMail session. Syntax: Logout() Parameters: None Return type: None SetAdministratorPassword Description: Set the administrator password. You must be logged in for this method to work. Syntax: SetAdministratorPassword (sNewPassword as string) Parameters: sNewPassword is the new password string. Return type: Boolean indicating if the call was successful. If not logged into the session then false will be returned. Reload Description: Reloads the WorkgroupMail data which will update the data stored in the API's memory. This function can be used when a change to the data has been made by another instance of the API or the WorkgroupMail administrator. Syntax: Reload() Parameters: None Return type: Boolean indicating success or failure. AddUser Description: Adds a user with the given name to the WorkgroupMail list of users. You must be logged in for this method to work. Syntax: AddUser(sName as string) Parameters: sName is the string that specifies the name of the user to be added. Return type: WMUser object that is the user added. Returns nothing if an error occurs such as not logged into the session. Example: set user = session.AddUser("Paul Kennedy") GetFirstUser Description: Gets the first user in the list of WorkgroupMail users. You must be logged in for this method to work. Syntax: GetFirstUser() Parameters: None Return type: WMUser object of the first user. Returns nothing if not logged into the session. GetNextUser Description: Get the next user in the list of WorkgroupMail users after the user passed into this method. Returns nothing if the user passed in is nothing or the last user You must be logged in for this method to work. Syntax: GetNextUser(user as object) Parameters: user is a WMUser object returned by a previous call to GetFirstUser() or GetNextUser(). Return type: WMUser object of the next user. Returns nothing if there is no next user. DeleteUser Description: Delete the given user from the list of WorkgroupMail users. You must be logged in for this method to work. Syntax: DeleteUser(user as object) Parameters: user is a WMUser object returned by a previous method call. Return type: Boolean indicating if the delete was successful or not. AddISP Description: Add a new ISP to WorkgroupMail with the given name You must be logged in for this method to work. Syntax: AddISP(sName as string) Parameters: sName is a string specifying the name of the new ISP. Return type: WMISP object which is the newly added ISP. GetFirstISP Description: Gets the first ISP in the list of WorkgroupMail ISPs. You must be logged in for this method to work. Syntax: GetFirstISP() Parameters: None Return type: WMISP object of the first ISP. Returns nothing if not logged into the session. GetNextISP Description: Get the next ISP in the list of WorkgroupMail ISPs after the ISP passed into this method. Returns nothing if the ISP passed in is nothing or the last ISP. You must be logged in for this method to work. Syntax: GetNextISP (isp as object) Parameters: isp is a WMISP object returned by a previous call to GetFirstISP() or GetNextISP(). Return type: WMISP object of the next ISP. Returns nothing if there is no next ISP. DeleteISP Description: Delete the given ISP from the list of WorkgroupMail ISPs You must be logged in for this method to work.. Syntax: DeleteISP(isp as object) Parameters: isp is a WMISP object returned by a previous method call. Return type: Boolean indicating success or failure. AddVirtualMailbox Description: Add a new virtual mailbox to WorkgroupMail with the given name. You must be logged in for this method to work. Syntax: AddVirtualMailbox(sName as string) Parameters: sName is the string specifying the name of the new virtual mailbox. Return type: WMVirtualMailbox object which is the newly added virtual mailbox. GetFirstVirtualMailbox Description: Gets the first virtual mailbox in the list of WorkgroupMail virtual mailboxes. You must be logged in for this method to work. Syntax: GetFirstVirtualMailbox() Parameters: None Return type: WMVirtualMailbox object of the first virtual mailbox. Returns nothing if not logged into the session. GetNextVirtualMailbox Description: Get the next virtual mailbox in the list of WorkgroupMail virtual mailboxes after the virtual mailbox passed into this method. Returns nothing if the virtual mailbox passed in is nothing or the last virtual mailbox. You must be logged in for this method to work. Syntax: GetNextVirtualMailbox(vmb as object) Parameters: vmb is a WMVirtualMailbox object returned by a previous call to GetFirstVirtualMailbox() or GetNextVirtualMailbox(). Return type: WMVirtualMailbox object of the next virtual mailbox. Returns nothing if there is no next virtual mailbox. DeleteVirtualMailbox Description: Delete the given virtual mailbox from the list of WorkgroupMail virtual mailboxes. You must be logged in for this method to work. Syntax: DeleteVirtualMailbox(vmb as object) Parameters: vmb is the WMVirtualMailbox object to be deleted. Return type: Boolean indicating success or failure. AddJunkMailEntry Description: Adds a mail address to the black list of junk mail addresses. You must be logged in for this method to work. Syntax: AddJunkMailEntry(sJunkMailAddress as string) Parameters: sJunkMailAddress is a string which is a junk mail address. Return type: Boolean indicating success or failure. GetFirstJunkMailEntry Description: Gets the first junk mail address in the black list. You must be logged in for this method to work. Syntax: GetFirstJunkMailEntry() Parameters: None Return type: String which is the first junk mail address. GetNextJunkMailEntry Description: Gets the next junk mail address after the junk mail address passed in. You must be logged in for this method to work. Syntax: GetNextJunkMailEntry(sJunkMailAddress as string) Parameters: sJunkMailAddress is a junk mail address string which is got from a previous call to GetFirstJunkMailEntry() or GetNextJunkMailEntry(). Return type: String which is the next junk mail address. DeleteJunkMailEntry Description: Deletes the junk mail address passed in. You must be logged in for this method to work. Syntax: DeleteJunkMailEntry(sJunkMailAddress as string) Parameters: sJunkMailAddress is the junk mail address string to be deleted. Return type: Boolean indicating success or failure. DisableSave Description: Disables saving changes to the WorkgroupMail data store. To enable changes to be saved you must call EnableSave() some time after this method call. This function might be called if a lot of changes are to be made so they can be made quickly without updating the data store and then the data store is updated when EnableSave() is called. Syntax: DisableSave() Parameters: None Return type: None EnableSave Description: Enables saving changes to the WorkgroupMail data store. If changes were made that have not been saved to the data store then this function will save those changes. Syntax: EnableSave() Parameters: None Return type: Boolean indicating success or failure. GetUserByID Description: Gets the WMUser object with the ID passed in. You must be logged in for this method to work. Syntax: GetUserByID(lID as long) Parameters: lID is a Long Integer specifying the ID of the user to be returned. Return type: WMUser object with the ID passed in. Returns nothing if the user cannot be found with the given ID. GetVirtualMailboxByID Description: Gets the virtual mailbox object with the ID passed in. You must be logged in for this method to work. Syntax: GetVirtualMailboxByID(lID as long) Parameters: | ||||||||||||||||||||||||||||||||||||||||||||