WebMail Pro PHP documentation

Plugin hooks

Introduction

Hooks are used to provide a way for plugins to perform custom actions and modify data during specific points of workflow.

For example, the use of api-integrator-login-to-account hook allows to modify user credentials prior to logging user in, which affects further behavior of the product.

Within the code of the product, a large number of hooks are available to provide ways to amend product behavior in various situations. Below, you'll find a list containing various hooks, split into functionality sections. Note this isn't a complete list, and we keep adding new hooks of course.

All the hooks are defined in the product the similar way, e.g.:

CApi::Plugin()->RunHook('api-integrator-login-to-account', array(
    &$sEmail, &$sIncPassword, &$sIncLogin, &$sLanguage, &$bAuthResult)
);

and when the hook is used in a plugin, list of its parameters is used there as well; in most cases, the meaning of those parameters is self-explaining.

Creating plugins and using plugin hooks are explained at Creating your own plugin documentation page.

Accounts

api-update-account
(&$oAccount, &$bUseOnlyHookUpdate)

Occurs when account properties need to be modified.

api-success-post-create-account-process-call
(&$oAccountToCreate)

When account is created via API successfully.

api-error-post-create-account-process-call
(&$oAccountToCreate, &$oException)

When creating account via API has failed.

account-update-password
(&$bAllowChangePassword)

When account password is updated.

api-integrator-get-loggined-user-id
(&$iUserId)

Obtaining ID of user currently logged in.

api-integrator-login-to-account
(&$sEmail, &$sIncPassword, &$sIncLogin, &$sLanguage, &$bAuthResult)

Logging user into their account. The hook allows for modifying user credentials on-the-fly.

api-integrator-login-authentication-error
($sEmail)

Occurs when user account authentication has failed.

api-integrator-login-success-post-create-account-call
(&$oAccount)

The operation of creating new account on first login was successful.

api-integrator-login-error-post-create-account-call
(&$oException)

The operation of creating new account on first login has failed.

api-integrator-login-to-account-result
(&$oResult)

Provides information on the account user is logged into.

api-change-account-on-login
(&$oAccount)

Allows for selecting a different account user needs to be logged into, instead of their default one.

Mail

api-mail-message-headers-parse
(&$this, $oHeaders)

Occurs when message headers are parsed.

api-mail-message-parse
(&$this, $oFetchResponse, $oBodyStructure, $sRfc822SubMimeIndex)

Occurs when full email message is parsed.

webmail.message-text-html-raw
($oAccount, &$oMessage, &$sText, &$bTextIsHtml)

Analyzing HTML source of the message.

webmail.message-plain-part
($oAccount, &$oMessage, &$sTextConverted)

Building plaintext part of the message.

webmail.message-html-part
($oAccount, &$oMessage, &$sTextConverted)

Building HTML part of the message.

webmail.build-message
(&$oMessage)

Creating a message.

webmail.validate-message-for-send
(&$oAccount, &$oMessage)

Checking if message meets the requirements so it can be sent out.

webmail.build-message-for-send
(&$oMessage)

Creating a message for sending out.

webmail.message-success-send
(&$oAccount, &$oMessage)

Occurs when message is sent out successfully.

webmail.build-message-for-save
(&$oMessage)

Creating a message for saving it into a folder.

webmail.message-suggest-email
(&$oAccount, &$aEmails)

Returns a list of email address autocompletion suggestions.

webmail.change-suggest-list
($oAccount, $sSearch, &$aList, &$aCounts)

Allows for amending the list of autocompletion suggestions.

Contacts

api-get-global-contact-items-count
(&$oDefAccount, &$sSearch)

Returns count of entries available in global address book.

api-get-global-contact-items
(&$oDefAccount, &$iSortField, &$iSortOrder, &$iOffset, &$iRequestLimit, &$sSearch)

Returns a list of entries available in global address book, or subset of the list.

api-get-global-contact-by-id
(&$oDefAccount, &$mGlobalContactId)

Locates an item from global address book based on its ID.

api-get-global-contact-by-email
(&$oDefAccount, &$sEmail)

Locates an item from global address book based on its email.

Files

filestorage.file-exists
($oAccount, $iType, $sPath, $sName, &$bResult, &$bBreak)

Checks if the file exists in file storage.

filestorage.get-file-info
($oAccount, $iType, $sPath, $sName, &$bResult, &$bBreak)

Returns information on specific file.

filestorage.get-file
($oAccount, $iType, $sPath, $sName, &$bResult, &$bBreak)

Returns file content.

filestorage.get-files
($oAccount, $sType, $sPath, $sPattern, &$bResult, &$bBreak)

Returns all the files that match specific pattern.

filestorage.create-file
($oAccount, $iType, $sPath, $sFileName, $mData, &$bResult, &$bBreak)

Creates a new file in file storage.

filestorage.create-folder
($oAccount, $iType, $sPath, $sFolderName, &$bResult, &$bBreak)

Creates a new folder in file storage.

filestorage.create-public-link
($oAccount, $iType, $sPath, $sName, &$bResult, &$bBreak)

Occurs when public link is created.

filestorage.delete-public-link
($oAccount, $iType, $sPath, $sName, &$bResult, &$bBreak)

Occurs upon deleting a public link.

filestorage.delete
($oAccount, $iType, $sPath, $sName, &$bResult, &$bBreak)

Occurs when file or folder is removed from files storage.

filestorage.rename
($oAccount, $iType, $sPath, $sName, $sNewName, &$bResult, &$bBreak)

Performed upon renaming file or folder.

filestorage.move
($oAccount, $iFromType, $iToType, $sFromPath, $sToPath, $sName, $sNewName, &$bResult, &$bBreak)

Occurs when file or folder is moved to another location in the file storage.

filestorage.copy
($oAccount, $iFromType, $iToType, $sFromPath, $sToPath, $sName, $sNewName, &$bResult, &$bBreak)

Occurs when file or folder is copied to another location in the file storage.

Helpdesk

api-integrator-login-to-helpdesk-user
(&$sEmail, &$sPassword)

Performed when user is logged into their helpdesk account.

api-integrator-login-to-helpdesk-user-result
(&$oResult)

Occurs upon logging user into helpdesk successfully, and returns matching account object.