Listener Addon not firing

I'm trying to make a listener Addon that send an email when a user account is deleted.

This is what I have, but no email is sent. I'm pretty sure the Addon isn't being triggered at all as I've tried the email sending code elsewhere and it works.

<?php

namespace Statamic\Addons\UserDeleted;

use Statamic\Extend\Listener;
use Statamic\API\Email;

class UserDeletedListener extends Listener
{

    public $events = [
        'UserDeleted' => 'sendEmail'
    ];

    public function sendEmail() {

        $email = \Statamic\API\Email::create();
        $email->to('[email protected]')->subject('Account Cancelled')->template('notify-admin-account-cancelled')->send();
    }
}

Thanks if anyone can help.

Answered by Erin Dalzell!
>>>>>>> Answered <<<<<<<
1 Reply
2 Followers