How to send a notification emails to multiple recipients

Created by Phil Kurth, Modified on Fri, 1 Jul, 2022 at 4:40 PM by Phil Kurth

You may configure a notification to send to multiple recipients by adding as many custom recipients, separated by commas, in the Custom recipient field:


Overriding the setting using code

It is possible to control the recipient field using the af/form/email/recipient filter. Doing so allows you much more control.

add_filter( 'af/form/email/recipient', function ( $recipient, $email, $form, $fields ) {
  // Override the recipient header for a specific form and a specific notifiation (by name)
  if ( $form['key'] === 'YOUR_FORM_KEY_HERE' and $email['name'] === 'My Example Notification' ) {
    $recipient = 'jane@doe.com, john@doe.com';
  }

  return $recipient;
}, 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