I'm trying to follow along with the guide on creating custom notification events in a plugin found here: https://sprout.barrelstrengthdesign.com/docs/email/custom-notification-events.html#register-event

I used their example Manual class as my notification and now I'm trying to register it, however, I get an error of:

Class barrelstrength\sproutbase\app\email\services\NotificationEmailEvents' not found.

I checked and made sure that the sprout email is installed and enabled and also my plugin is installed and enabled.

Below is what is in my main plugin file:

namespace mycompany\plugin;

use myname\company\notifications\Manual as PluginManualNotification;

use barrelstrength\sproutbase\app\email\services\NotificationEmailEvents;
use barrelstrength\sproutbase\app\email\events\NotificationEmailEvent;

use Craft;
use craft\base\Plugin;
use craft\services\Plugins;
use craft\events\PluginEvent;

use yii\base\Event;

class MyPlugin extends Plugin
    public static $plugin;
    public $schemaVersion = '1.0.0';

    public function init()
        self::$plugin = $this;

            function (PluginEvent $event) {
                if ($event->plugin === $this) {
                    // We were just installed.

            function (NotificationEmailEvent $event) {
                $event->events[] = PluginManualNotification::class;

    /* Create settings modal and other unrelated stuff */

The docs at the time of the question reference an old classname in the C3 example, the two Notification Email related classes in your code are now in a module named sprout-base-email:

use barrelstrength\sproutbaseemail\services\NotificationEmailEvents;
use barrelstrength\sproutbaseemail\base\NotificationEvent;

use barrelstrength\sproutbase\app\email\services\NotificationEmailEvents;
use barrelstrength\sproutbase\app\email\events\NotificationEmailEvent;

|improve this answer|||||
  • This brings up a new error for me: Argument 1 passed to myPlugin\{closure}() must be an instance of barrelstrength\sproutbaseemail\base\NotificationEmailEvent, instance of barrelstrength\sproutbaseemail\events\NotificationEmailEvent given which is strange because I am not using barrelstrength\sproutbaseemail\events anywhere in my plugin. – Mr.Smithyyy Dec 12 '19 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.