<p>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 <code>sprout-base-email</code>:</p>

<pre><code>NEW
use barrelstrength\sproutbaseemail\services\NotificationEmailEvents;
use barrelstrength\sproutbaseemail\base\NotificationEvent;

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

</code></pre>

CC BY-SA 4.0
2019-12-12T14:14:24.083Z
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
CC BY-SA 4.0
2019-12-11T17:31:22.970Z
2019-12-11T17:31:22.970Z
Ben Parizek
<p>I'm trying to follow along with the guide on creating custom notification events in a plugin found here: <a href="https://sprout.barrelstrengthdesign.com/docs/email/custom-notification-events.html#register-event" rel="nofollow noreferrer">https://sprout.barrelstrengthdesign.com/docs/email/custom-notification-events.html#register-event</a></p>

<p>I used their example <a href="https://github.com/barrelstrength/craft-sprout-email/blob/develop/src/events/notificationevents/Manual.php" rel="nofollow noreferrer">Manual class</a> as my notification and now I'm trying to register it, however, I get an error of:</p>

<p><code>Class barrelstrength\sproutbase\app\email\services\NotificationEmailEvents' not found.</code> </p>

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

<p>Below is what is in my main plugin file:</p>

<pre class="lang-php prettyprint-override"><code>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()
    {
        parent::init();
        self::$plugin = $this;

        Event::on(
            Plugins::class,
            Plugins::EVENT_AFTER_INSTALL_PLUGIN,
            function (PluginEvent $event) {
                if ($event-&gt;plugin === $this) {
                    // We were just installed.
                }
            }
        );

        Event::on(
            NotificationEmailEvents::class,
            NotificationEmailEvents::EVENT_REGISTER_EMAIL_EVENT_TYPES,
            function (NotificationEmailEvent $event) {
                $event-&gt;events[] = PluginManualNotification::class;
            }
        );
    }

    /* Create settings modal and other unrelated stuff */
}
</code></pre>

<plugin-sproutemail>
NotificationEmailEvents class not found
# NotificationEmailEvents class not found

(Asked by: username_0 on 2019-12-10)

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()
    {
        parent::init();
        self::$plugin = $this;

        Event::on(
            Plugins::class,
            Plugins::EVENT_AFTER_INSTALL_PLUGIN,
            function (PluginEvent $event) {
                if ($event->plugin === $this) {
                    // We were just installed.
                }
            }
        );

        Event::on(
            NotificationEmailEvents::class,
            NotificationEmailEvents::EVENT_REGISTER_EMAIL_EVENT_TYPES,
            function (NotificationEmailEvent $event) {
                $event->events[] = PluginManualNotification::class;
            }
        );
    }

    /* Create settings modal and other unrelated stuff */
}

**Tags:** plugin-sproutemail

---

## 1 answers

### Answer by username_1 on 2019-12-11. Score: 2

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:
NEW
use barrelstrength\sproutbaseemail\services\NotificationEmailEvents;
use barrelstrength\sproutbaseemail\base\NotificationEvent;

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

> **Comments:**
> **username_0**: 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.  

---

