Hi,
I had a working form in version 3.0 Stable. But the I wanted to be able to attach file to my email form so I upgraded to version 3.1 RC5.5. I have seen in the faq that the method to add emailaddresses via php changed but i can't get it to work.
In 3.0 stable I used the folowing code. The first if sends a copy of the email if requested with a checkbox (kopie) and gets the emailaddress from a textfield(eigenmail).
The next ones are checkboxes to select the recipients
I tried to change to code to get it working in version 3.1, I tried the following but it didn't work (I left out the last checkboxes because method will be the same). Could somebody find out what the problem is?
I had a working form in version 3.0 Stable. But the I wanted to be able to attach file to my email form so I upgraded to version 3.1 RC5.5. I have seen in the faq that the method to add emailaddresses via php changed but i can't get it to work.
In 3.0 stable I used the folowing code. The first if sends a copy of the email if requested with a checkbox (kopie) and gets the emailaddress from a textfield(eigenmail).
The next ones are checkboxes to select the recipients
<?php
if(JRequest::getVar('kopie')) {
$emails[0]->bcc .= ','.JRequest::getVar('eigenmail');
}
if(JRequest::getVar('cantincrode')) {
$emails[0]->bcc .= ',mail1@exemple.com';
if(JRequest::getVar('dijle')) {
$emails[0]->bcc .= ',mail2@exemple.com';
}
if(JRequest::getVar('molenbos')) {
$emails[0]->bcc .= ',mail3@exemple.com';
}
if(JRequest::getVar('rupel')) {
$emails[0]->bcc .= ',mail4@exemple.com';
}
if(JRequest::getVar('waverheide')) {
$emails[0]->bcc .= ',mail5@exemple.com';
}
if(JRequest::getVar('gouwbureau')) {
$emails[0]->bcc .= ',mail6@exemple.com';
}
if(JRequest::getVar('gouwraad')) {
$emails[0]->bcc .= ',mail7@exemple.com';
}
if(JRequest::getVar('gouwoverleg')) {
$emails[0]->bcc .= ',mail8@exemple.com';
}
?>
I tried to change to code to get it working in version 3.1, I tried the following but it didn't work (I left out the last checkboxes because method will be the same). Could somebody find out what the problem is?
<?php
$MyForm =& CFChronoForm::getInstance('mailing');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
if(JRequest::getVar('kopie')) {
$MyFormEmails->setEmailData(1, 'bcc', .JRequest::getVar('eigenmail'));
}
if(JRequest::getVar('cantincrode')) {
$MyFormEmails->setEmailData(1, 'bcc', 'mail1@exemple.com');
}
?>