craftcms/contact-form

Argument 1 passed to modules\appmodule\AppModule::modules\appmodule\{closure}() must be an instance of craft\contactform\events\SendEvent, instance of yii\mail\MailEvent given

MichaelBrauner opened this issue · 1 comments

Description

When I want to hook into the afterSend - Event like this:

Event::on(Mailer::class, Mailer::EVENT_AFTER_SEND, static function (SendEvent $e) {});

Craft expects to get an yii\mail\MailEvent not an craft\contactform\events\SendEvent.

Maybe this is something to change in the documentation?

Found out that I imported the wrong Mailer class. Sorry.