rtec_email_recipients
is a filter for dynamically assigning email addresses to the list of recipients for email messages sent from the plugin.
Usage
<?php add_filter( 'rtec_email_recipients', 'function_name', 10, 3 ); ?>
Parameters
$recipients – (array) Array of email addresses added as the “to:” name.
$template_type – (string) Type of email template being used, “confirmation” or “notification”.
$data – Event and registration data attached to the email, if it exists.
Changelog
Pro
2.11 – introduced
Example: Send Confirmation Emails to More Than One Email Address
Step 1) Create a form field for recording an additional email address (or multiple fields for multiple additional email addresses)
Step 2) Use this code that searches every field for a valid email address and adds it as a recipient for all confirmation emails.
function ru_confirmation_to_additional_emails( $recipients, $template_type, $data ) {
if ( $template_type === 'confirmation' ) {
foreach ( $data as $key => $value ) {
if ( $key !== 'email' && is_email( $value ) ) {
$recipients[] = $value;
}
}
}
return $recipients;
}
add_filter( 'rtec_email_recipients', 'ru_confirmation_to_additional_emails', 10, 3 );