Home > Developer Guide > Hooks > Mail Hooks
hook_civicrm_mailSetupActions
Summary
Register special actions for setting up new mail accounts.
Description
For certain types of mail accounts -- such as Google Mail and Microsoft Exchange Online -- the setup process may require some special orchestration (e.g. performing OAuth connection).
This hook allows one to define special variations on the "Add Mail Account" action. In the example below, there is a special setup action for "Microsoft Exchange Online".
Availability
CiviCRM 5.32+
Definition
hook_civicrm_mailSetupActions(&$setupActions)
Parameters
&$setupActions
: array, list of available setup actions. The array-key is a symbolic name. Each action has properties:title
: stringcallback
: callable,function(array $setupAction): array
Returns
null
Example
function mymod_civicrm_mailSetupActions(&$setupActions) {
$setupActions['supermail'] = [
'title' => ts('Super Mail'),
'callback' => '_mymod_setup',
];
}
function _mymod_setup($setupAction) {
return [
'url' => '...the-next-setup-page...',
];
}