Hello, I'm a new user chronoforms 4RC2.0 joomla 1.5.
I'm trying to send email to multiple recipients by taking their emails from sobi2 items which the user chooses. I made a script which enters the id values of sobi2 items into session. Now what I want is for chronoform to get them id's, get the corresponding email addresses from database (sobi2_fields_data table)
and send them the email.
I did not understand how to work with session data action, so instead I made custom php code and added it to the "On Submit" event. The code gets the emails into 1 variable and separating them by commas. here is the code:
So at this point I don't know how to add those to cc or bcc fields. If I understand correctly I need to add those to the $form object but how? or maybe there is a better way to do all that?
Thanks
I'm trying to send email to multiple recipients by taking their emails from sobi2 items which the user chooses. I made a script which enters the id values of sobi2 items into session. Now what I want is for chronoform to get them id's, get the corresponding email addresses from database (sobi2_fields_data table)
and send them the email.
I did not understand how to work with session data action, so instead I made custom php code and added it to the "On Submit" event. The code gets the emails into 1 variable and separating them by commas. here is the code:
$db =& JFactory::getDBO();
$session =& JFactory::getSession();
$cc_ids_arr = JRequest::getVar('sobisend'); //get id's array from session (sobi2 item id's)
$jj=0;
foreach ($cc_ids_arr as $m_id) {
$query = "SELECT * FROM `#__sobi2_fields_data` WHERE `fieldid` = '7' AND `itemid`='$m_id'";
$db->setQuery($query);
$row = $db->loadAssoc();
if($jj == 0){$comma = "";}else{$comma = ", ";}
$cc_emails .= $comma.$row['data_txt'];
//$result = $database->loadObject();
$jj++;
}
So at this point I don't know how to add those to cc or bcc fields. If I understand correctly I need to add those to the $form object but how? or maybe there is a better way to do all that?
Thanks