New Filter for Default Email Message

Currently, an automated email message is generated for forms containing “Email” actions when users leave the email content field blank. Are you open to the idea of introducing an extra filter in this context? A new filter like bricks/email/default_message would offer the capability to customize the default email content and modifying it depending on user input and form field settings.

Code Example

Specifically, the filter could be implemented here:

// includes/integrations/form/actions/email.php

public function get_default_message($form_settings, $form_fields) {
	$message    = '';
	$index      = 0;
	$line_break = isset($form_settings['htmlEmail']) ? '<br>' : "\n";

	foreach ($form_fields as $key => $value) {
		if (strpos($key, 'form-field-') === false) {

		if (!empty($form_settings['fields'][$index]['label'])) {
			$message .= $form_settings['fields'][$index]['label'] . ': ';

		$value = !empty($value) && is_array($value) ? implode(', ', $value) : $value;

		$message .= $value . $line_break;


	if (isset($_POST['referrer'])) {
		$message .= "{$line_break}{$line_break}" . esc_html__('Message sent from:', 'bricks') . ' ' . esc_url($_POST['referrer']);

	// Apply Filter for the email message. The $form_settings and $form_fields helps us to create dynamic default messages.
	$message = apply_filters('bricks/email/default_message', $message, $form_settings, $form_fields);

	return $message;

Use Cases

Exclude specific field types or IDs

The current default message includes all fields created in the form settings. Sometimes, however, you may want to exclude certain field types from it. This could be hidden fields, which are not needed for the email itself, but for other form actions – or just one single field we don’t want to send with the others.

Conditional Disclaimer / Note

Sometimes we want to append a specific disclaimer or note to the email messages only when a certain form field is present or has a specific value. With this filter, such conditions could be easily implemented.

Adjusting Email Layout Based on Settings

Scenario: Your form allows admins to choose between a “Compact” or “Detailed” layout for email notifications in the form settings. If it’s “Compact”, only include essential fields in the email. If “Detailed”, include all fields with additional explanatory text or annotations. This could be interesting for confirmation emails.


Basically, such a filter also will save time. If you include the content of the email manually, you will have to update the content every time fields change. If the Bricks default content can be personalized with a filter, it can be used much more effectively.

I look forward to hearing from you what you think about this request :slight_smile: