logo
Knowledge Base
Developers4 min read

Developing MailWizz Extensions

MailWizz is highly extendable by creating custom extensions suited to your needs. You can add custom business logic suited for your specific business or industry. You can make exte...

MailWizz is highly extendable by creating custom extensions suited to your needs. You can add custom business logic suited for your specific business or industry. You can make extensions that target only specific areas like the backend, customer, frontend, API etc. You can hook in one or more apps and work with the existing toolset that your organisation uses. You can add to your settings page and load your custom controllers. You can even modify the current MailWizz controllers to modify how MailWizz behaves, all through easy-to-use examples. See some of the example code below.

General extension info


*// name of the extension as shown in the backend panel*
public $name = 'Example';
*// description of the extension as shown in backend panel*
public $description = 'This is an example extension';
*// current version of this extension*
public $version = '1.0';
*// minimum app version*
public $minAppVersion = '1.3.6.2';
*// the author name*
public $author = 'Your name';
*// author website*
public $website = 'http://www.domain.com/';
*// contact email address*
public $email = 'dev@domain.com';

Allowed app restrictions

To specify which app the extension will run in (Eg. customer, backend, frontend, api, console)

public $allowedApps = array('*');

CLI Enabling

To enable CLI if you need to hook inside console hooks. This is to explicitly enable it.

public $cliEnabled = true;

Customer area hooks

An example to hook into customer area and add a menu item

if ($this->isAppName('customer')) {
*// let's add some text in the footer:*
Yii::app()->hooks->addAction('layout_footer_html', function($controller){
echo "The controller is:" . $controller->id . " and this is added from: " . __FILE__ . ':' . __LINE__ . '<br />';
*// remember that actions don't have to return, they have to echo*
*// we can also try to echo the dummy_setting option:*
$extension = Yii::app()->extensionsManager->getExtensionInstance('example');
echo $extension->getOption('dummy_setting', 'show this if no dummy_setting text') . '<br />';
});
*// let's add a dummy menu item*
Yii::app()->hooks->addFilter('customer_left_navigation_menu_items', function($menuItems) {
$menuItems['googleLink'] = array(
'name' => Yii::t('app', 'Google'),
'icon' => 'glyphicon-star',
'active' => '',
'route' => 'http://www.google.com',
'items' => array(),
'linkOptions' => array('target' => '_blank'),
);
*// remember that filters have to return the first param.*
return $menuItems;
});
}

Frontend area hooks

To change the frontend area like redirection and adding text to the footer example

if ($this->isAppName('frontend')) {
*// let's add some text in the footer:*
Yii::app()->hooks->addAction('layout_footer_html', function($controller){
echo "<br /><b>The controller is: " . $controller->id . " and this is added from: " . __FILE__ . ':' . __LINE__ . '</b><br />';
*// remember that actions don't have to return, they have to echo*
*// we can also try to echo the dummy_setting option:*
$extension = Yii::app()->extensionsManager->getExtensionInstance('example');
echo $extension->getOption('dummy_setting', 'show this if no dummy_setting text') . '<br />';
});
*/***
 ** When you visit the site, mailwizz redirects you to customer area*
 ** because there is no landing page.*
 ***
 ** Let's add one, a very basic one, by overriding the site controllers*
 ** with our own. Note that our own controller will also extend the SiteController*
 ** So this way we only override what we need, leaving everything else to be served by mailwizz.*
 **/*
Yii::app()->controllerMap['site'] = array(
*// remember the ext-example path alias?*
'class' => 'ext-example.frontend.controllers.Ext_example_siteController',
*// pass the extension instance as a variable to the controller*
'extension' => $this,
);
}
}

On disable function

To run a certain function as user disables the custom extension. Other possible options include afterDisable(), beforeDelete(), afterDelete()

public function beforeDisable()
{
*// your code here*
*// call parent*
return parent::beforeDisable();
}

A lot of other resources can be found on the official MailWizz website. Please refer to it for further clarity.

Related articles

Developers2 min read

Hooks, actions, filters in MailWizz extension

MailWizz is modular and allows you to interact with pieces of code within. It does this by use of hooks. MailWizz offers two hooks called 'Action' and 'Filters'. You can write a cu...

Read article
Developers1 min read

Generate an API key

To make API calls, you need an API key. You can generate an API key from your account. Login to Deploia deployed MailWizz platform Go to "API keys" from the sidebar menu Click on "...

Read article
Developers2 min read

Accessing API Documentation

Please visit the "category for developers" to view our API documentation. Don't forget to "generate an API key", without which you cannot make any API calls. Navigation Menu: The l...

Read article

Copyright © 2025 - Jonah and Associates Pty Ltd