# Problems with the "email contact form" - Cookbook

**URL:** <https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809>\
**Category:** Questions\
**Tags:** v3\
**Created:** [October 22, 2022, 2:37pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809 "2022-10-22T14:37:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khepri.Design](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/khepri.design/32/13857_2.png) [@Khepri.Design](https://forum.getkirby.com/u/Khepri.Design)\
**Post date:** [October 22, 2022, 2:37pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/1 "2022-10-22T14:37:46Z")

</div>

Hi there,

i completely recreated the instruction for a simple contact form like you mentioned here: [Contact form | Kirby CMS](https://getkirby.com/docs/cookbook/forms/basic-contact-form)

But for some reason if i fill out the form in the frontend, the page just reloads. No errors, no mail sent.

The instruction in [Sending emails | Kirby CMS](https://getkirby.com/docs/guide/emails) works for me. I use a smtp server which i reffered in the config.php like that, and it works for me:

```auto
  'email' => [
    'transport' => [
      'type' => 'smtp',
      'host' => 'web01.st-srv.eu',
      'username' => 'info@khepri.design',
      'password' => '...',
      'port' => 465,
      'auth' => true,
      'security' => true
    ]
  ]

```

so doing the following works for me:

```auto
  $kirby->email([
    'from' => $from,
    'to' => 'info@khepri.design',
    'subject' => 'Welcome!',
    'body'=> 'It\'s great to have you with us',
  ]);

```

Did i miss something i have to do for the contact form?

greetings

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 22, 2022, 2:44pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/2 "2022-10-22T14:44:56Z")

</div>

Did you copy the example to the T? No other page names, field names etc?

---

<div class="post-metadata">

**Author:** ![Khepri.Design](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/khepri.design/32/13857_2.png) [@Khepri.Design](https://forum.getkirby.com/u/Khepri.Design)\
**Post date:** [October 22, 2022, 3:12pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/3 "2022-10-22T15:12:08Z")

</div>

Everything the same like mentioned in the example

contact.php in templates.  
contact.php in controllers.  
contact.yml currently with no content in blueprints.  
email.php in templates-\>emails.  
email.html.php in templates-\>emails.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 22, 2022, 3:40pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/4 "2022-10-22T15:40:21Z")

</div>

Could you add a

```auto
dump($_POST)

```

before and after this line in the controller

```auto
    if($kirby->request()->is('POST') && get('submit')) {

```

You should get two arrays showing up after hitting submit.

---

<div class="post-metadata">

**Author:** ![Khepri.Design](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/khepri.design/32/13857_2.png) [@Khepri.Design](https://forum.getkirby.com/u/Khepri.Design)\
**Post date:** [October 22, 2022, 3:46pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/5 "2022-10-22T15:46:17Z")

</div>

```auto
    dump($_POST);
    if($kirby->request()->is('POST') && get('submit')) {
        dump($_POST);
        // check the honeypot
        if(empty(get('website')) === false) {
            go($page->url());
            exit;
        }
         . . . 

```

The first array is shown up before hitting send. Its empty. After sending nothing changes. Page reloads and its only one empty array.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 22, 2022, 4:42pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/6 "2022-10-22T16:42:06Z")

</div>

> [@Khepri.Design](#):
>
> After sending nothing changes.

Yes, $\_POST will be empty when loading the page, that’s normal. But after hitting submit, the first dump should contain the post data (and also the second one, if the if statement is true).

```auto
Array
(
    [website] => 
    [name] => Sonja
    [email] => me@example.de
    [text] => Hello from the form                                                                    
    [submit] => Submit
)

```

I just tested the code in 3.8.0 and its still running fine.

---

<div class="post-metadata">

**Author:** ![Khepri.Design](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/khepri.design/32/13857_2.png) [@Khepri.Design](https://forum.getkirby.com/u/Khepri.Design)\
**Post date:** [October 22, 2022, 5:28pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/7 "2022-10-22T17:28:20Z")

</div>

I updatet my system to 3.8.1 and founded the issue (which isnt really a issue).  
I noticed the honeypot checker, in the controller, which reloads the page if its triggert.  
If i delete this check, everything works and the form gets sent via mail.

The question is now, why ist the honeypot triggert?  
Tested it in chrome, brave, firefox, edge. Also via incognitotab.

```auto
        if(empty(get('website')) === false) {
            go($page->url());
            exit;
        }

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 22, 2022, 5:36pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/8 "2022-10-22T17:36:33Z")

</div>

> [@Khepri.Design](#):
>
> I noticed the honeypot checker, in the controller, which reloads the page if its triggert.

Well, yes, that’s the whole point of the honeypot. If the field is filled in, nothing happens because the field is supposed to remain empty (and hidden)

---

<div class="post-metadata">

**Author:** ![Khepri.Design](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/khepri.design/32/13857_2.png) [@Khepri.Design](https://forum.getkirby.com/u/Khepri.Design)\
**Post date:** [October 22, 2022, 6:02pm UTC](https://forum.getkirby.com/t/problems-with-the-email-contact-form-cookbook/26809/9 "2022-10-22T18:02:51Z")

</div>

ahh i get it. I just messed something up while compiling sass, so the field was not hidden. I didnt get that “website” is the honeypot field and filled it out manuelly. I got tricked…  
Thanks for your help here.
