Hi Max and Bob!
I have just updated from 3.0 stable to 3.1 RC5 and find that my form no longer works. I set the $mails[0] array in the On Submit Before code. The info set is, among others, the to address, the from name and the fromemail. I also transfer info to the email template with str_replace. This method worked quite well in version 3.0 stable. In version 3.1, it seems as if the $emails[0] array is not found (or out of context?), because the debug output shows the the same dummy data I set in the fields in the email definition. How can I make this work in version 3.1 RC5?
On Submit Before Code (part of):
Email Template:
/ Michel
I have just updated from 3.0 stable to 3.1 RC5 and find that my form no longer works. I set the $mails[0] array in the On Submit Before code. The info set is, among others, the to address, the from name and the fromemail. I also transfer info to the email template with str_replace. This method worked quite well in version 3.0 stable. In version 3.1, it seems as if the $emails[0] array is not found (or out of context?), because the debug output shows the the same dummy data I set in the fields in the email definition. How can I make this work in version 3.1 RC5?
On Submit Before Code (part of):
<?php
// get email and name for the logged in user (the message sender)
$user = JFactory::getUser();
$emails[0]->fromemail = $user->email;
$emails[0]->fromname = $user->name;
$emails[0]->template = str_replace('##name##',$user->name,$emails[0]->template);
$emails[0]->template = str_replace('##username##',$user->username,$emails[0]->template);
// Get admin email from database
$database = &JFactory::getDBO();
$query = "SELECT * FROM jos_users WHERE id = '62'";
$database->setQuery( $query );
$data = $database->loadObject();
$emails[0]->to = $data->email;
?>
Email Template:
----------------------------------------------
From: ##name##, username: ##username##
Date and time (CET): ##dateandtime##
IP: ##ipaddress##
----------------------------------------------
Message:--------------------------------------
{message}
----------------------------------------------
##ccadr##
##attachment##
/ Michel
Hi jmhook,
I'm afraid that Max is going to have to answer this one. There are some major changes in the code in this release and while this should make it simpler to access the emails I can't easily work out how to do it from the Onubmit box :-(
Bob
I'm afraid that Max is going to have to answer this one. There are some major changes in the code in this release and while this should make it simpler to access the emails I can't easily work out how to do it from the Onubmit box :-(
Bob
Hi Michel,
in the new release we will need to use this to access/change emails data:
Cheers
Max
in the new release we will need to use this to access/change emails data:
$MyForm =& CFChronoForm::getInstance('fomrname');//use form name
//emails instance
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$MyFormEmails->setEmailData(1, 'to', 'admin@email.com'); //email_id, parameter name, value
Cheers
Max
This topic is locked and no more replies can be posted.