Commentions Plugin Problem: Call to a member function email() on null

Hi there,
i installed the new Commention plugin and it works fine so far, apart from one problem:
I can’t get the email hook get to work. When i copy this into my config file:

'hooks' => [
   'commentions.add:after' => function ( $page, $data ) {
    try {
       'from' => '',
       'to' => '',
       'subject' => 'New comment/webmention on ' . $page->title(),
       'body'=> print_r($data, true),
  } catch (Exception $error) {
    echo $error;

i get the error message: Call to a member function email() on null

I checked if php email works, and with the kirby contact form it works fine (with a controller & template setup).
I don’t understand the problem, did anyone else had it yet?

You can’t use $kirby inside your hook, use kirby() instead.

1 Like

:raised_hand: Mea culpa – a typo in the Readme indeed! The documentation example now correctly features kirby().

Thanks a lot! This was something i just couldn’t solve myself.