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