before sending email - $email variable

blue 26 Nov, 2009
Hi,

I was using the $email variable replace some text in all the emails templates in the "On Submit code - before sending email:" like this:


for($i=0;$i<count($emails);$i++){
   $emails[$i]->template = str_replace('{_tipo}', $tvalues['tipo'], $emails[$i]->template);
   $emails[$i]->template = str_replace('{_grupo}', $tvalues['grupo'], $emails[$i]->template);
   $emails[$i]->template = str_replace('{_valor_sem_iva}', number_format($tvalues['valor_sem_iva'], 2, ',', ' '), $emails[$i]->template);
   $emails[$i]->template = str_replace('{_taxa_adene_sem_iva}', number_format($tvalues['taxa_adene_sem_iva'], 2, ',', ' '), $emails[$i]->template);
   $emails[$i]->template = str_replace('{_valor_final_com_iva}', number_format($tvalues['valor_final_com_iva'], 2, ',', ' '), $emails[$i]->template);

   $emails[$i]->template = str_replace('{_tipo_de_imovel}', $tmvalue, $emails[$i]->template);
   $emails[$i]->template = str_replace('{_resposta}', $rvalue, $emails[$i]->template);
}


but now with the ChronoForms_V3.1_RC5 the $email variable seems to be NULL or empty,
this variable has change?
is there any other way to do this?

many thanks in advance
blue
Max_admin 29 Nov, 2009
yes, it was changed, now you need to do this:


$MyForm = $this->getInstance('form name here');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);



then use $MyFormEmails->template

also $MyFormEmails->emails is the emails array!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.