Mailer

Sections

What it Provides

Once the Service Provider is registered (as per the installation instructions, your app will have access to:

Setup

You will need to install the Manrill API in order to use the mailer:

composer require mandrill/mandrill:1.0.*

MenuItems

The EnsoMailerServiceProvider automatically sets up a Menu item for the Enso Mailer. It has a root Node of Mailer, set up with a default order value 40. This has child nodes for Campaigns and Audiences

You can modify this using the EnsoMenu facade's EnsoMenu::updateItemByLabel('Mailer', [...]) feature to either change it's order number or to add children (such as a menu item for a mailing list of email addresses that are not associated with user accounts).

Facade

The EnsoMailerServiceProvider automatially registers the facade: EnsoMailer, which is used to set and get any dynamic config for this package. Dynamic configuration consists of Adding additional Operands and Operators to meet yout app's requirements.

Settings

The EnsoMailerServiceProvider adds a new Tab Mailer to the Settings page. As such, having settings set up is required for this to function fully. This contains:

  • Header Image Background image for the header bar. Leaving this empty will fallback to a branded colour.
  • Company Logo (if none is set, it will user the Company Name, finally falling back to the Site name in the Header instead)
  • Copyright Notice
  • Company Name (Footer). Falls back to Site name if not set.
  • Company Email (Footer). Falls back to Administrator Email setting.

Overrides

You can Override many features of the Mailer by extending base classes or implementing interfaces and binding those in a ServiceProvider.

Additionally, you can override the Base query that you entire Mailer module runs from. In the EnsoMailerServiceProvider, it is bound to

    $this->app->bind('enso-mailer-query', function() {
        return App::make(UserContract::class)::query();
    });

You can bind it to any other User Model query you like in one of your app's service providers. For eample, you may (probably should) add some functionality for users to unsubscribe from your mail service. You could create a notUnsubscribed query scope and add that to your base query. Both Campaigns and Audiences will respect this modification.

    $this->app->bind('enso-mailer-query', function() {
        return App::make(UserContract::class)::notUnsubscribed();
    });