I'm trying to send a sprout email from my plugin like so:
use barrelstrength\sproutbaseemail\mailers\DefaultMailer;
use barrelstrength\sproutbaseemail\SproutBaseEmail;
use barrelstrength\sproutbaseemail\elements\NotificationEmail;
use Craft;
use craft\base\Plugin;
use yii\base\Event;
class MyPlugin extends Plugin
{
public function init()
{
$mailer = SproutBaseEmail::$app->mailers->getMailerByName(DefaultMailer::class);
// How do I let it know what email to send?
$mailer->sendNotificationEmail();
}
}
It says that sendNotificationEmail
expects an instance of NotificationEmail
but I can't seem to find any documentation on how to reference the notification email created on the dashboard so it can be sent.
The only similar question I found was this but it's for Craft2.