You need do small modification for checkbox. For exmaple you have a checkbox field (element_3) with 3 options, then your options id will be element_3_1, element_3_2, and element_3_3.
First you need to change the code in "edit/custom-hooks.php" file to be like this :
function form18_hook_email($params){
//change the email addresses below
$email_list1[1] = 'sales@example.com';
$email_list1[2] = 'hrd@example.com';
$email_list1[3] = 'support@example.com';
$email_list1[4] = 'accounts@example.com';
$email_list1[5] = 'legal@example.org';
$res = do_query("select element_3_1,element_3_2,element_3_3 from ap_form_{$params['form_id']}
where id='{$params['entry_id']}'");
$row = do_fetch_result($res);
//get email for checkbox 1
$attn = $row['element_3_1'];
if ($attn == '1') {$target_email = $email_list1[1] ;}
//get email for checkbox 2
$attn = $row['element_3_2'];
if ($attn == '1') {$target_email .= "," . $email_list1[2] ;}
//get email for checkbox 3
$attn = $row['element_3_3'];
if ($attn == '1') {$target_email .= ",". $email_list1[3] ;}
if(!empty($target_email)){
return $target_email;
}else {
return true;
}
}
after that you need to change the custom code in "includes/helper-functions.php" file from :
if($target_is_admin){
if(function_exists("form{$form_id}_hook_email")){
$carbon_param['form_id'] = $form_id;
$carbon_param['entry_id'] = $entry_id;
$carbon_email = call_user_func("form{$form_id}_hook_email",$carbon_param);
if(!empty($carbon_email)){
$mail->AddAddress($carbon_email);
$mail->Send();
}
}
}
to
if($target_is_admin){
if(function_exists("form{$form_id}_hook_email")){
$carbon_param['form_id'] = $form_id;
$carbon_param['entry_id'] = $entry_id;
$carbon_email = call_user_func("form{$form_id}_hook_email",$carbon_param);
if(!empty($carbon_email)){
$email_address = explode(',',$carbon_email);
foreach ($email_address as $email){
$email = trim($email);
if(!empty($email)){
$mail->AddAddress($email);
$has_email = true;
}
}
$mail->Send();
$mail->ClearAddresses();
}
}
}