getFormName(); $message = $this->getNiceFields(); return mail( $to, $subject, $message, $additional_headers = [], $additional_params = "" ); } private function getNiceFields(): string { $text = ''; foreach ($this->getFormFields() as $field) { $name = $field['name'] ?? ''; $label = $field['label'] ?? $name; $value = $this->getEntryFields()[$name] ?? ''; if (is_array($value)) { $value = implode(', ', array_map('strval', $value)); } elseif (!is_scalar($value)) { $value = ''; } $text .= $label . ': ' . $value . "\n"; } return $text; } }