Adding custom email headers (e.g; CC, BCC, Reply-To) to notification emails

Created by Phil Kurth, Modified on Thu, 23 Jun, 2022 at 4:10 PM by Phil Kurth

You may add custom email headers using the af/form/email/headers filter


function filter_email_headers( $headers, $email, $form, $fields ) {
	// Set the reply-to address
	$headers[] = 'Reply-To: john@doe.com';

	// Set the CC header
	$headers[] = 'CC: john@doe.com, jane@doe.com';

	// Set the BCC header
	$headers[] = 'BCC: jack@doe.com, jill@doe.com';

	return $headers;
}
add_filter( 'af/form/email/headers/key=FORM_KEY', 'filter_email_headers', 10, 4 );

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article