diff --git a/src/Forms/Email.php b/src/Forms/Email.php index 30722022c5..e5571f1105 100644 --- a/src/Forms/Email.php +++ b/src/Forms/Email.php @@ -153,11 +153,11 @@ private function attachFiles($field) protected function addData() { $augmented = $this->submission->toAugmentedArray(); - $fields = $this->getRenderableFieldData(Arr::except($augmented, ['id', 'date', 'form'])); - - if (Arr::has($this->config, 'attachments')) { - $fields = $fields->reject(fn ($field) => in_array($field['fieldtype'], ['assets', 'files'])); - } + $fields = $this->getRenderableFieldData(Arr::except($augmented, ['id', 'date', 'form'])) + ->reject(fn ($field) => $field['fieldtype'] === 'spacer') + ->when(Arr::has($this->config, 'attachments'), function ($fields) { + return $fields->reject(fn ($field) => in_array($field['fieldtype'], ['assets', 'files'])); + }); $data = array_merge($augmented, $this->getGlobalsData(), [ 'config' => config()->all(),