Dynamic to's - Sending to Multiple Addresses

hk9090 29 Dec, 2014
Hi,

I'm trying to get a form to send its data to dynamic email addresses that depend on a custom dropdown box. So far I have it working fine, however still have a small issue that has prevented my form from working: If the user selects a particular value, it must be able to send a message to multiple users (and not only one).

I have the following code:

<?php
$recipient = JRequest::getString('equipo', 'em1', 'post');
$emails = array (
'A330' => array('xxxx.xxxxx@mdm,com', 'xxxx@mdm.com'),
'A320_CAP' => 'xxxxxxxxx@xxxx.xxx.xx',
'B787' => 'xxx@xx.xx' );

$form->data['email_to_use'] = $emails[$recipient];
?>

Lines two and three (A330 and A320) work perfectly fine. Line one however (A330) does not work. I tried it using comma, semicolon, array, no array and unfortunately could not get it to work. Of course if I only select one address the form works fine, but I do need to send to more than one address.


I'd appreciate any help or lights on this issue. Thank you!


This is my debug data:

Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => RepoIncapacidades
[event] => submit
[Itemid] =>
[nombre_tripulante] => xxx xxx
[cedula_tripulante] => xxxx
[email_tripulante] => xx@xx.xx
[Cargo] =>
[equipo] =>
[inicio_incapacidad] => 2014-12-09
[finalizacion_incapacidad] =>
[comentarios] =>
[email_equipo] =>
[input_submit_33] => Enviar
[4b92de99b041c349e7439d7c69be2e95] => 1
[from_name] => xx xx
[subject] => Reporte de Incapacidades xxxxx
[email_to_use] => Array
(
[0] => xxxx.xxxx@mdm.com
[1] => xxxx@mdm.com
)

)
Validation Errors:
Array
(
)
Debug Data
email
10
Result
An email has been SENT successfully from (Comunicaciones Operacionales)xxxx@xxxx.xxxto Array
Body
Herramienta Reporte Incapacidades 2014

Información Tripulante

Nombre xxxx
Cédula Tripulante xxxxx
Cargo
Equipo
Fecha Inicio Incapacidad 2014-12-09
Fecha de Finalización de Incapacidad
Comentarios


Submitted by xxxxx
Attachments
array ( )
La información fue recibida con éxito, cualquier inconveniente nos comunicaremos con usted.
GreyHead 31 Dec, 2014
Hi hk9090,

I think that the standard Email action in CFv4 doesn't support more than one email address when used like this. If you get my Email [GH] action from here that will support arrays or comma separated strings of addresses.

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