Description

The wpforms_emails_send_email_data filter lets you modify the raw email data before WPForms sends it. You can use this filter to change recipients, subjects, messages, headers, or attachments on a per-email basis. This filter is useful for localization, branding, or targeting specific notifications based on the recipient address, form settings, or other available data.

parametertypedescription
$dataarrayThe email data array, including to, subject, message, headers, and attachments.
$emailobjectThe email object instance (WPForms_WP_Emails) for the outgoing message.

Source

wpforms/includes/emails/class-emails.php

Example

/**
 * Add a prefix to all WPForms email subjects.
 */
function wpf_dev_prefix_email_subject( $data, $email ) {
    $data['subject'] = '[WPForms] ' . $data['subject'];
    return $data;
}
add_filter( 'wpforms_emails_send_email_data', 'wpf_dev_prefix_email_subject', 10, 2 );