I have an ACF repeater field field_5f71d4eaaf381
for email addresses and I want to output a comma separate list of the sub field values (measurement_extra_email_address) to create a $to
for the WordPress mail function.
$values = $_POST['acf'];
$extra_recipients = $_POST['acf']['field_5f71d4eaaf381'];
if ( $extra_recipients ) {
$list = array();
foreach( $extra_recipients as $extra_recipient ) {
$list[] = $extra_recipient['measurement_extra_email_address'];
}
$to = implode(',', $list);
}
I thought above code should/would do it but no email is being send so I guess the code is incorrect..?
Just a note: When I remove above part of the code and just try $to = '[email protected]';
an e-mail is being send so the error should be in there...
Here's the code I was looking for: