get('bcc', ''))){ $bccemails = explode(",", trim($email_params->get('bcc', '')));}if(trim($email_params->get('dbcc', ''))){ $dynamic_bccemails = explode(",", trim($email_params->get('dbcc', ''))); foreach($dynamic_bccemails as $dynamic_bccemail){ if($form->data[trim($dynamic_bccemail)]){ $bccemails[] = $form->data[trim($dynamic_bccemail)]; } }}But if I use more than one address in one of those fields I get an invalid field error. The email is sent anyway but not to those addresses.I made a test, adding a Custom Code just before the Email action:$form->data['bccaddresses'] = 'email1@example.com,email2@example.com';No way, same error.I suppose there's some check somewhere? Where?Thank you maxx"> dynamic email to many addresses - Forums

Forums

dynamic email to many addresses

emmexx 16 Feb, 2013
I'm not sure if this is a bug or it works like that "by design" but I can't send emails to multiple addresses if I use a field with many addresses separated by comma.

I checked the source code in admin/form_actions/email/email.php and from what I understand the following code should manage multiple addresses in one field:

// BCCs
$bccemails = array();
if(trim($email_params->get('bcc', ''))){
	$bccemails = explode(",", trim($email_params->get('bcc', '')));
}
if(trim($email_params->get('dbcc', ''))){
	$dynamic_bccemails = explode(",", trim($email_params->get('dbcc', '')));
	foreach($dynamic_bccemails as $dynamic_bccemail){
		if($form->data[trim($dynamic_bccemail)]){
			$bccemails[] = $form->data[trim($dynamic_bccemail)];
		}
	}
}


But if I use more than one address in one of those fields I get an invalid field error. The email is sent anyway but not to those addresses.

I made a test, adding a Custom Code just before the Email action:

$form->data['bccaddresses'] = 'email1@example.com,email2@example.com';


No way, same error.

I suppose there's some check somewhere? Where?

Thank you
maxx
GreyHead 16 Feb, 2013
Hi Max,

The standard Email action only supports a single dynamic email address, get my Email [GH] action which supports comma separated lists and/or array values.

Bob
This topic is locked and no more replies can be posted.