Description

Filters email message output that is sent.

Parameters

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

Source

wpforms/includes/emails/class-emails.php

More Information

The wpforms_email_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

When sending plain text emails, it may be necessary to remove these dashes so that you can parse your email information into a Google spreadsheet (for example).

/**
 * 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 WPForms_WP_Emails class
 * @return string
 */

function wpf_dev_email_message( $message, $emails ) {
	
    // Remove dashes from labels
    $email = str_replace( array( '--- ', ' ---' ), '', $message );
    return $email;
}
add_filter( 'wpforms_email_message', 'wpf_dev_email_message', 10, 2 );

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