Description

The wpforms_emails_notifications_message filters the email message output that is sent.

Parameters

$message
(string) (Required) Email message, including processed Smart Tags.
$emails
(object) (Required) Instance of the email class, which handles all notification emails sent by WPForms.

Source

wpforms/src/Emails/Notifications.php

More Information

The wpforms_emails_notifications_message filter is applied to all emails that are sent from WPForms such as processed Smart Tags and includes the dashes separating the labels of each form field.

Examples

In this example, we’re using the Plain Text email template and would like to remove the dashes that are displayed when using this method.

/**
 * Filters dashes from labels on plain text email.
 *
 * @link   https://wpforms.com/developers/wpforms_email_message/
 * 
 * @param  string $message  Email message including Smart Tags.
 * @param  object $emails   Instance of the email class
 * @return string
 */

function wpf_dev_email_message( $message, $emails ) {
	
    // Remove dashes from labels
    $email = str_replace( array( '--- ', ' ---' ), '', $message );

    return $email;

}

add_filter( 'wpforms_emails_notifications_message', 'wpf_dev_email_message', 10, 2 );

remove the dashes from your plain text emails with the wpforms_email_message filter

Please know if you’re using the Legacy email template, you can use the wpforms_email_message filter instead.

Tutorial Reference: How to Customize the Styles on the Email Template

FAQ

Q: Why are there 2 different directories for templates?

A: Within WPForms template directory, you’ll notice /wpforms/includes/emails/templates and /wpforms/templates/emails. There are differences between these 2 folders, so if you’re creating your own template, please be sure to follow the guide above for naming and storing your files. The email template found in the /wpforms/includes/ directory is only used to generate content for Notification emails related to the forms.

The /wpforms/templates/ folder contains various files, with the ones labeled with general used for system-related emails such as when a form import process is completed. The templates labeled with summary are used for the Email Summaries template.