Simple contact form

Hello everyone!

I have been working on a contact form doing this recipe:

Works fine, but I only cant get it to work on the home template though.
I redid the whole thing in the plainkit but no luck. Anything I can do?

return function($page, $pages, $site, $kirby) {

Something on the above maybe?


What did you change to make it work on the home page?

Nothing. I didnt get it to work because I dont know why it wouldnt. What can it possibly be?
If you place the code in the starterkit you see that it works on any template but the home.

Hm, I just cloned a fresh 3.9.5 Starterkit, and put the code from the contact.php controller into a newly created home.php controller, replaced the code in home.php template with code from contact.php template.

Created the email template in site/templates/emails.

Added my Mailhog smtp data in config and started the Mailhog container.

And the form works as expected.

Ok I will try to do the same steps.
The templates/home.php does not work with the controllers/site.php then I guess?
It needs its own controller being controllers/home.php. Correct?

In my case the controllers/site.php does communicate with the templates/home.php but just the form doesnt send some how.

Just wondering, I never entered the mailhog smtp data, but it did work on the other pages.
The issue wont have anything to do with that right?

In the next step I collected the files in a plugin, but I think the plugin structure can not integrate controllers, right?

Thanks again!!

      'snippets' => [
            'blocks/share' => __DIR__ . '/snippets/share.php',

      'templates' => [
            'emails/email' => __DIR__ . '/emails/email.php',
            'emails/email.html' => __DIR__ . '/emails/email.html.php',
      'controllers' => [
            'site' => __DIR__ . '/controllers/site.php'


Edit: Hm, it should actually, if you don’t have another home.php controller.

You can also use a general site controller called site.php which you put into your /site/controllers folder like any other page controller. Such a general site controller is useful if multiple templates share the same logic, while they don’t need any template specific logic. It works like a normal page controller but will only be applied to templates that do not have a specific page controller.


No, MailHog is what I use locally to intercept mail. That’s not the issue.