Forums

Checkboxes to change emails

paulxb 26 Jul, 2012
I've created a form to email different email addresses based on what check boxes are ticked. So if check box A is tick the email will go to [email]A@domain.com[/email], if B is ticked as well the email will go to [email]A@domain.com[/email] and [email]B@domain.com[/email]

I've added a custom code task in the On Submit to generate the emails:

<?php
$section = $form->data['section'];
$form->data['to_email'] = '';

foreach ($section as $s)
{
  $form->data['to_email'] .= $s.'.nan@domain.org.uk,';
} 
$form->data['to_email'] .= 'webmaster@domain.org.uk';
$form->data['comments'] = $form->data['to_email'];
?>


and added an email task with "to_email" in the dynamic to box. I've also populated the static to/from/subject.

When I submit the for the debug text (and comments box) gets the correct emails, but they never get send to the dynamic addresses.

Any ideas?


I'm using Joomla 2.5.5 and ChromoForms 4.0 RC3.4.1

Thanks,
Paul
GreyHead 26 Jul, 2012
Hi Paul,

If I remember correctly the standard Email action won't accept a comma separated list in the Dynamic box. Try my Email [GH] action instead - it's much more flexible in what you can add; and it will accept an array as well as a comma separated list.

Bob
paulxb 27 Jul, 2012
Hi Bob,

It worked great, thanks!

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