craftcms / contact-form

Add a simple contact form to your Craft CMS site.
https://plugins.craftcms.com/contact-form
MIT License
294 stars 93 forks source link

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 #199

Closed MichaelBrauner closed 4 years ago

MichaelBrauner commented 4 years ago

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?

MichaelBrauner commented 4 years ago

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