Home / Archive / WPForms: add BCC email header to notification emails
Duplicate Snippet

Embed Snippet on Your Site

WPForms: add BCC email header to notification emails

Check the snippet code to apply to all/some form only, plus you will need to modify the email address that will be used in BCC.

Code Preview
php
<?php
add_filter( 'wpforms_email_headers', function ( $headers, $emails ) {
	// APPLY THE BCC TO THIS FORM ID ONLY.
	// CHANGE THE ID TO THE FORM YOU NEED. OR REMOVE THE WHOLE IF BLOCK IF NEEDED FOR ALL FORMS.
	if ( 42 !== $emails->form_data['id'] ) {
		return $headers;
	}
	// CHANGE THIS EMAIL ADDRESS TO YOURS:
	$bcc_email = '[email protected]';
	$headers .= "Bcc: $bcc_email\r\n";
	return $headers;
}, 10, 2 );

Comments

Add a Comment