Not all fields showing in received email form (Uniform)


I am using Uniform for an AJAX form.

When the form is received via email, the “Email” submitted in the input by the user is not included.

The route looks like:

'routes' => [

  'pattern' => '(:all)',
  'method' => 'POST',
  'action' => function () {
      $form = new \Uniform\Form([
          'name' => [],
          'email' => [
              'rules' => ['required', 'email'],
              'message' => 'Please enter a valid email address',
          'message' => [
              'rules' => ['required'],
              'message' => 'Please enter a message',

      // Perform validation and execute guards.

      if (!$form->success()) {
          // Return validation errors.
          return Response::json($form->errors(), 400);

      // If validation and guards passed, execute the action.
          'to'      => '',
          'from'    => '',

      if (!$form->success()) {
          // This should not happen and is our fault.
          return Response::json($form->errors(), 500);

      // Return code 200 on success.
      return Response::json([], 200);

The form is:

<form class="form__contact" action="<?= $page->url() ?>" method="POST">
    <input name="name" placeholder="Name" type="text">
    <input name="email" placeholder="Email" type="email">
    <div class="textarea__wrapper">
        <textarea placeholder="Message" name="message"></textarea>

    <?php echo csrf_field() ?>
    <?php echo honeypot_field() ?>
    <p id="message"></p>
    <input type="submit" value="Submit">

My understanding is that Uniform’s default template will grab and display each $field and $value however when I receive the email it is just:

Name: Inputted Name

Message: Inputted Message

:thinking: Any ideas @mzur ? I am sure I am just missing something very simple

The email key is unset here for the body data: kirby-uniform/EmailAction.php at bfd1464c8e135b06200ed928f6bf571df3578310 · mzur/kirby-uniform · GitHub

Ohh… thanks for pointing that out.

I could of course remove that line (so it is not unset), but is there another more elegant way so I do not change the plugin files, do you know?

Quick guess, put it the array of data you send with your email, with a different key:

          'to'      => '',
          'from'    => '',
          'data' => [
             'myemailkey' => esc($_POST['email']),

You could also use the emails/uniform-default email template which includes all form fields.