Hi! I am using Joomla 1.5.3 After I sent the form this warning appears: "Could not instantiate mail function" Does anyine knows what is wrong? I have all the pathches ( for Joomla 1.5 and upgrade too). The permissions are set to 755.
O, I am using 1&1 hosting.
This is my form:
http://www.embryokpc.net/index.php?option=com_chronocontact&chronoformname=VetQuestion
I got validation to work. But can not figure this thing out for sending mails.
Ideas... Anyone?
O, I am using 1&1 hosting.
This is my form:
http://www.embryokpc.net/index.php?option=com_chronocontact&chronoformname=VetQuestion
I got validation to work. But can not figure this thing out for sending mails.
Ideas... Anyone?
Hi jm08,
Most likely you don't have mail configured properly in the site Global Config. You'll need to check out the 1&1 manual and make sure you have a setup that they support.
Bob
Most likely you don't have mail configured properly in the site Global Config. You'll need to check out the 1&1 manual and make sure you have a setup that they support.
Bob
I too have this problem but my mail is configured correctly in the global configuration because I receive emails when I create new accounts just not from chrono forms.
Hi serta,
as Bob said, you have some problem somewhere with the mail setup, lets try 2 things:
#1- show me a screenshot of your Emails setup tab here!
#2- try to use SMTP emails, sometimes the PHP mailer fails!
as Bob said, you have some problem somewhere with the mail setup, lets try 2 things:
#1- show me a screenshot of your Emails setup tab here!
#2- try to use SMTP emails, sometimes the PHP mailer fails!
I have tried to use all three email options without any luck, but currently I am setup to use SMTP because I know that works when I create accounts. I am currently setup with version 3.
Hi serta,
if you have issues with other options then probably there is something wrong, can you drop your host an email and tell him that your PHPMailer doesn't work and see what the say ?
Regards
Max
if you have issues with other options then probably there is something wrong, can you drop your host an email and tell him that your PHPMailer doesn't work and see what the say ?
Regards
Max
Well, it worked with SMTP email on ChronoForms version 2.5. I just really would like to be able to use version 3.
Hi serta,
the 2 components are using the same Joomla function, do you have V3 beta 2 ? show me your 2.5 config!
the 2 components are using the same Joomla function, do you have V3 beta 2 ? show me your 2.5 config!
That is OK...I have found the problem. It is somewhere in the chronocontact.php file. I am not sure exactly where it is but I replaced the chronocontact.php file of version 3 beta 2 with a working chronocontact.php file from version 2.5. I had to go through each file step by step and replace a few sections with the corresponding sections from the version 3 chronocontact.php file until I got it to work. Even without the debug on it will print what looks like email tracking, trying to connect to my server and send the email. But if you give it a redirect url that won't be a problem.
Hi serta,
whats the last section you replaced before you got it to work ?
whats the last section you replaced before you got it to work ?
I'm not real sure what the last section was before I was able to get to work. I forgot that I also had to change some of the code in the chronocontact.html.php file, just added a $posted parameter but it worked even without doing that, it just had a "notice". However I believe that the last section of code was the following:
I removed this section from the version 2.5 chronocontact.php file:
if ( ($rows[0]->emailresults != 0) && !$error_found ) {
/**
* The send e-mail switch
* Case 1: 'Yes' standard (not in use)
* Case 2: 'Yes' custom (default)
*/
switch ( $rows[0]->emailresults ) {
/**
* E-mail the results - 'Yes' standard
* Not in use!
*/
case 1:
if ( $debug) { echo "E-mail: 'Yes' standard<br />"; }
$from = $chronocontact_params->get('from_email');
$fromname = $chronocontact_params->get('from_name');
$subject = $chronocontact_params->get('subject');
$recipient[] = $chronocontact_params->get('primary_email');
break;
case 2:
default:
/**
* E-mail the results - 'Yes' custom
*/
if ( $debug) { echo "E-mail: 'Yes' custom<br />"; }
$from = $paramsvalues->from_email;
$fromname = $paramsvalues->from_name;
$subject = $rows[0]->emailsubject;
$recipient = str_replace(" ","",$rows[0]->extraemail);
$recipient = explode(",", $recipient);
if(trim($paramsvalues->ccemail)){
$ccemails = str_replace(" ","",$paramsvalues->ccemail);
$ccemails = explode(",", $ccemails);
}else{
$ccemails = NULL;
}
if(trim($paramsvalues->bccemail)){
$bccemails = str_replace(" ","",$paramsvalues->bccemail);
$bccemails = explode(",", $bccemails);
}else{
$bccemails = NULL;
}
if(trim($paramsvalues->replyto_email)){
$replyto_email = str_replace(" ","",$paramsvalues->replyto_email);
$replyto_email = explode(",", $replyto_email);
}else{
$replyto_email = NULL;
}
if(trim($paramsvalues->replyto_name)){
$replyto_name = str_replace(" ","",$paramsvalues->replyto_name);
$replyto_name = explode(",", $replyto_name);
}else{
$replyto_name = NULL;
}
break;
}
//$replyto = $chronocontact_params->get('replyto_email');
/**
* Substitute field values if they are set
*/
if ( trim($paramsvalues->subjectfield) != "" ) {
$subject = $_POST[$paramsvalues->subjectfield];
}
if ( trim($paramsvalues->fromemailfield) != "" ) {
$from = $_POST[$paramsvalues->fromemailfield];
}
if ( trim($paramsvalues->fromnamefield) != "" ) {
$fromname = $_POST[$paramsvalues->fromnamefield];
}
if ( trim($paramsvalues->emailfield) != "" ) {
$recipient[] = $_POST[$paramsvalues->emailfield];
}
if ( trim($paramsvalues->ccfield) != "" ) {
$ccemails[] = $_POST[$paramsvalues->ccfield];
}
if ( trim($paramsvalues->bccfield) != "" ) {
$bccemails[] = $_POST[$paramsvalues->bccfield];
}
}
And replaced it with the following code from the version 3 chronocontact.php file:
if ( ($rows[0]->emailresults != 0) && !$error_found ) {
/*************** check to see if order was specified, if not then use the default old one ************************/
if((!$paramsvalues->plugins_order)&&(!$paramsvalues->onsubmitcode_order)&&(!$paramsvalues->autogenerated_order)){
$paramsvalues->autogenerated_order=3;
$paramsvalues->onsubmitcode_order=2;
$paramsvalues->plugins_order=1;
}
for($ixx = 1 ; $ixx <= 3; $ixx++){
if($paramsvalues->plugins_order == $ixx){
$ava_plugins = explode(",",$paramsvalues->plugins);
$ava_plugins_order = explode(",",$paramsvalues->mplugins_order);
//$ava_plugins_array = array();
array_multisort($ava_plugins_order, $ava_plugins);
foreach($ava_plugins as $ava_plugin){
$query = "SELECT * FROM #__chrono_contact_plugins WHERE form_id='".$rows[0]->id."' AND event='ONSUBMIT' AND name='".$ava_plugin."'";
$database->setQuery( $query );
$plugins = $database->loadObjectList();
if(count($plugins)){
require_once(JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php");
${$ava_plugin} = new $ava_plugin();
$registry2 = new JRegistry();
$registry2->loadINI( $plugins[0]->params );
$params = $registry2->toObject( );
if($params->onsubmit != 'before_email'){
${$ava_plugin}->onsubmit( 'com_chronocontact', $params , $plugins[0] );
}
}
}
}
/**
* Run the On-submit 'post e-mail' code if there is any
*/
if($paramsvalues->onsubmitcode_order == $ixx){
if ( !empty($rows[0]->onsubmitcode) ) {
eval( "?>".$rows[0]->onsubmitcode );
}
}
/**
* Run the SQL query if there is one
*/
if($paramsvalues->savedataorder == 'after_email'){
if($paramsvalues->autogenerated_order == $ixx){
if ( !empty($rows[0]->autogenerated) ) {
eval( "?>".$rows[0]->autogenerated );
}
}
}
}
/**
* Redirect the page if requested
*/
if ( !empty($rows[0]->redirecturl) ) {
$mainframe->redirect($rows[0]->redirecturl);
}
}
But I took a version 2.5 chronocontact.php file and inserted into version 3 with just a little editing. So the part that made the email work was the part that I DID NOT edit, because version 2.5 worked before. What I changed in the version 2.5 chronocontact.php and in the version 3 chronocontact.html.php file was just to get the version 2.5 file to work with version 3.
I removed this section from the version 2.5 chronocontact.php file:
if ( ($rows[0]->emailresults != 0) && !$error_found ) {
/**
* The send e-mail switch
* Case 1: 'Yes' standard (not in use)
* Case 2: 'Yes' custom (default)
*/
switch ( $rows[0]->emailresults ) {
/**
* E-mail the results - 'Yes' standard
* Not in use!
*/
case 1:
if ( $debug) { echo "E-mail: 'Yes' standard<br />"; }
$from = $chronocontact_params->get('from_email');
$fromname = $chronocontact_params->get('from_name');
$subject = $chronocontact_params->get('subject');
$recipient[] = $chronocontact_params->get('primary_email');
break;
case 2:
default:
/**
* E-mail the results - 'Yes' custom
*/
if ( $debug) { echo "E-mail: 'Yes' custom<br />"; }
$from = $paramsvalues->from_email;
$fromname = $paramsvalues->from_name;
$subject = $rows[0]->emailsubject;
$recipient = str_replace(" ","",$rows[0]->extraemail);
$recipient = explode(",", $recipient);
if(trim($paramsvalues->ccemail)){
$ccemails = str_replace(" ","",$paramsvalues->ccemail);
$ccemails = explode(",", $ccemails);
}else{
$ccemails = NULL;
}
if(trim($paramsvalues->bccemail)){
$bccemails = str_replace(" ","",$paramsvalues->bccemail);
$bccemails = explode(",", $bccemails);
}else{
$bccemails = NULL;
}
if(trim($paramsvalues->replyto_email)){
$replyto_email = str_replace(" ","",$paramsvalues->replyto_email);
$replyto_email = explode(",", $replyto_email);
}else{
$replyto_email = NULL;
}
if(trim($paramsvalues->replyto_name)){
$replyto_name = str_replace(" ","",$paramsvalues->replyto_name);
$replyto_name = explode(",", $replyto_name);
}else{
$replyto_name = NULL;
}
break;
}
//$replyto = $chronocontact_params->get('replyto_email');
/**
* Substitute field values if they are set
*/
if ( trim($paramsvalues->subjectfield) != "" ) {
$subject = $_POST[$paramsvalues->subjectfield];
}
if ( trim($paramsvalues->fromemailfield) != "" ) {
$from = $_POST[$paramsvalues->fromemailfield];
}
if ( trim($paramsvalues->fromnamefield) != "" ) {
$fromname = $_POST[$paramsvalues->fromnamefield];
}
if ( trim($paramsvalues->emailfield) != "" ) {
$recipient[] = $_POST[$paramsvalues->emailfield];
}
if ( trim($paramsvalues->ccfield) != "" ) {
$ccemails[] = $_POST[$paramsvalues->ccfield];
}
if ( trim($paramsvalues->bccfield) != "" ) {
$bccemails[] = $_POST[$paramsvalues->bccfield];
}
}
And replaced it with the following code from the version 3 chronocontact.php file:
if ( ($rows[0]->emailresults != 0) && !$error_found ) {
/*************** check to see if order was specified, if not then use the default old one ************************/
if((!$paramsvalues->plugins_order)&&(!$paramsvalues->onsubmitcode_order)&&(!$paramsvalues->autogenerated_order)){
$paramsvalues->autogenerated_order=3;
$paramsvalues->onsubmitcode_order=2;
$paramsvalues->plugins_order=1;
}
for($ixx = 1 ; $ixx <= 3; $ixx++){
if($paramsvalues->plugins_order == $ixx){
$ava_plugins = explode(",",$paramsvalues->plugins);
$ava_plugins_order = explode(",",$paramsvalues->mplugins_order);
//$ava_plugins_array = array();
array_multisort($ava_plugins_order, $ava_plugins);
foreach($ava_plugins as $ava_plugin){
$query = "SELECT * FROM #__chrono_contact_plugins WHERE form_id='".$rows[0]->id."' AND event='ONSUBMIT' AND name='".$ava_plugin."'";
$database->setQuery( $query );
$plugins = $database->loadObjectList();
if(count($plugins)){
require_once(JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php");
${$ava_plugin} = new $ava_plugin();
$registry2 = new JRegistry();
$registry2->loadINI( $plugins[0]->params );
$params = $registry2->toObject( );
if($params->onsubmit != 'before_email'){
${$ava_plugin}->onsubmit( 'com_chronocontact', $params , $plugins[0] );
}
}
}
}
/**
* Run the On-submit 'post e-mail' code if there is any
*/
if($paramsvalues->onsubmitcode_order == $ixx){
if ( !empty($rows[0]->onsubmitcode) ) {
eval( "?>".$rows[0]->onsubmitcode );
}
}
/**
* Run the SQL query if there is one
*/
if($paramsvalues->savedataorder == 'after_email'){
if($paramsvalues->autogenerated_order == $ixx){
if ( !empty($rows[0]->autogenerated) ) {
eval( "?>".$rows[0]->autogenerated );
}
}
}
}
/**
* Redirect the page if requested
*/
if ( !empty($rows[0]->redirecturl) ) {
$mainframe->redirect($rows[0]->redirecturl);
}
}
But I took a version 2.5 chronocontact.php file and inserted into version 3 with just a little editing. So the part that made the email work was the part that I DID NOT edit, because version 2.5 worked before. What I changed in the version 2.5 chronocontact.php and in the version 3 chronocontact.html.php file was just to get the version 2.5 file to work with version 3.
Hi serta, thank you very much for the details!
Hey Serta
I followed your instructions but im getting error on the script line 470
Which is something to do with the parameters i think.
What else did you do?
This problem has been bugging for awhile.
Thanks in advance if someone with more php knowledge can fix this problem for me.
Heres my script
<?php
/**
* CHRONOFORMS version 1.0 stable
* Copyright (c) 2006 Chrono_Man, ChronoEngine.com. All rights reserved.
* Author: Chrono_Man (ChronoEngine.com)
* See readme.html.
* Visit http://www.ChronoEngine.com for regular update and information.
**/
/* ensure that this file is called by another file */
defined('_JEXEC') or die('Restricted access');
/**
* Load the HTML class
*/
require_once( JApplicationHelper::getPath( 'front_html' ) );
require_once( JApplicationHelper::getPath( 'class' ) );
$posted = array();
$posted = $_POST;
/**
* Main switch statement
*/
switch( $task ) {
case 'send':
uploadandmail();
break;
default:
showform($posted);
break;
}
/**
* End of main page
*
*/
/**
* Display the form for entry
*
*/
function showform($posted)
{
global $mainframe;
$database =& JFactory::getDBO();
$formname = JRequest::getVar( 'chronoformname', '', 'get', 'string', '' );
//$formname = $_GET['chronoformname'];
if ( !$formname ) {
$query = "
SELECT params
FROM #__menu
WHERE id='".$_GET['Itemid']."' AND type='component'";
$database->setQuery( $query );
$menudata = $database->loadResult();
if ( $menudata ) {
$registry = new JRegistry();
$registry->loadINI( $menudata );
$configs = $registry->toObject( );
$formname = $configs->formname;
}
}
$imver = "";
$query = "
SELECT *
FROM #__chrono_contact
WHERE name = '$formname'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$registry = new JRegistry();
$registry->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry->toObject( );
if ( trim($paramsvalues->imagever) == 'Yes' ) {
$imver = '<input name="chrono_verification" type="text" id="chrono_verification" value="">
  <img src="'.JURI::Base()
.'components/com_chronocontact/chrono_verification.php?imtype='.$paramsvalues->imtype.'">';
}
$htmlstring = $rows[0]->html;
if( trim($paramsvalues->validate) == 'Yes'){
// Easy Validation //
preg_match_all('/name=("|\').*?("|\')/i', $htmlstring, $matches);
$arr_required = explode(",", str_replace(" ","",$paramsvalues->val_required));
$arr_validate_number = explode(",", str_replace(" ","",$paramsvalues->val_validate_number));
$arr_validate_digits = explode(",", str_replace(" ","",$paramsvalues->val_validate_digits));
$arr_validate_alpha = explode(",", str_replace(" ","",$paramsvalues->val_validate_alpha));
$arr_validate_alphanum = explode(",", str_replace(" ","",$paramsvalues->val_validate_alphanum));
$arr_validate_date = explode(",", str_replace(" ","",$paramsvalues->val_validate_date));
$arr_validate_email = explode(",", str_replace(" ","",$paramsvalues->val_validate_email));
$arr_validate_url = explode(",", str_replace(" ","",$paramsvalues->val_validate_url));
$arr_validate_date_au = explode(",", str_replace(" ","",$paramsvalues->val_validate_date_au));
$arr_validate_currency_dollar = explode(",", str_replace(" ","",$paramsvalues->val_validate_currency_dollar));
$arr_validate_selection = explode(",", str_replace(" ","",$paramsvalues->val_validate_selection));
$arr_validate_one_required = explode(",", str_replace(" ","",$paramsvalues->val_validate_one_required));
$arr_all = array_merge($arr_required, $arr_validate_number, $arr_validate_digits, $arr_validate_alpha, $arr_validate_alphanum, $arr_validate_date, $arr_validate_email, $arr_validate_url, $arr_validate_date_au,
$arr_validate_currency_dollar, $arr_validate_selection, $arr_validate_one_required);
foreach ($matches[0] as $match)
{
$new_match = preg_replace('/name=("|\')/i', '', $match);
$new_match2 = preg_replace('/("|\')/', '', $new_match);
$name = preg_replace('/name=("|\')/', '', $new_match2);
$class_array = array();
if(in_array($name,$arr_all)){
if(in_array($name,$arr_required)){
$class_array[] = "required";
}
if(in_array($name,$arr_validate_number)){
$class_array[] = "validate-number";
}
if(in_array($name,$arr_validate_digits)){
$class_array[] = "validate-digits";
}
if(in_array($name,$arr_validate_alpha)){
$class_array[] = "validate-alpha";
}
if(in_array($name,$arr_validate_alphanum)){
$class_array[] = "validate-alphanum";
}
if(in_array($name,$arr_validate_date)){
$class_array[] = "validate-date";
}
if(in_array($name,$arr_validate_email)){
$class_array[] = "validate-email";
}
if(in_array($name,$arr_validate_url)){
$class_array[] = "validate-url";
}
if(in_array($name,$arr_validate_date_au)){
$class_array[] = "validate-date-au";
}
if(in_array($name,$arr_validate_currency_dollar)){
$class_array[] = "validate-currency-dollar";
}
if(in_array($name,$arr_validate_selection)){
$class_array[] = "validate-selection";
}
if(in_array($name,$arr_validate_one_required)){
$class_array[] = "validate-one-required";
}
$class_string = implode(" ",$class_array);
$htmlstring = str_replace($match,$match.' class="'.$class_string.'"',$htmlstring);
}
}
$rows[0]->html = $htmlstring;
}
/// end validation //
HTML_ChronoContact::showform( $rows , $imver);
}
/**
* Respond to a submitted form
*
*/
function uploadandmail()
{
global $mainframe;
$database =& JFactory::getDBO();
// Block SPAM through the submit URL
if ( empty($_POST) ) {
echo "You are not allowed to access this URL directly, POST array is empty";
return;
}
/**
* Retrieve form data from the database
*/
$formname = JRequest::getVar( 'chronoformname', '', 'get', 'string', '' );
//$formname = $_GET['chronoformname'];
$query = "
SELECT *
FROM #__chrono_contact
WHERE name='$formname'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$registry = new JRegistry();
$registry->loadINI( $rows[0]->titlesall );
$titlesvalues = $registry->toObject( );
$registry = new JRegistry();
$registry->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry->toObject( );
$error_found = false;
/**
* If imageversification is on check the code
*/
if ( trim($paramsvalues->imagever) == 'Yes' ) {
/*if (session_name() != md5('chrono')){
session_write_close();
}
session_name(md5('chrono'));
*/
//session_start();
$session =& JFactory::getSession();
$sessionvar = $session->get('chrono_verification', 'default', md5('chrono'));
$chrono_verification = strtolower($_POST['chrono_verification']);
if ( md5($chrono_verification ) != $sessionvar ) {
showErrorMessage('Sorry, You have entered a wrong verification code, Please try again!!');
showform($_POST);
return;
}else{
unset($_SESSION['chrono_verification']);
}
}
/**
* if $debug is true then ChronoForms will show diagnostic output
*/
$debug = $paramsvalues->debug;
if ( $debug ) {
echo "_POST: ";
print_r($_POST);
echo "<br />";
}
/**
* Upload attachments
*/
$attachments = array();
if ( trim($paramsvalues->uploads == 'Yes' ) && trim($paramsvalues->uploadfields) ) {
//$allowed_s1 = explode(",", trim($paramsvalues->uploadfields));
if ( is_array($paramsvalues->uploadfields) ) {
$allowed_s1 = implode('|', $paramsvalues->uploadfields);
} else {
$allowed_s1 = $paramsvalues->uploadfields;
}
$allowed_s1 = explode(",", trim($allowed_s1));
foreach ( $allowed_s1 as $allowed_1 ) {
$allowed_s2 = explode(":", trim($allowed_1));
$allowed_s3 = explode("|", trim($allowed_s2[1]));
$original_name = $_FILES[$allowed_s2[0]]['tmp_name'];
$filename = date('YmdHis').'_'.preg_replace('`[^a-z0-9-_.]`i','',$_FILES[$allowed_s2[0]]['name']);
$fileok = true;
if ( $original_name ) {
if ( ($_FILES[$allowed_s2[0]]["size"] / 1024) > trim($paramsvalues->uploadmax) ) {
$fileok = false;
showErrorMessage('Sorry, Your uploaded file size exceeds the allowed limit.');
exit();
}
if ( ($_FILES[$allowed_s2[0]]["size"] / 1024) < trim($paramsvalues->uploadmin) ) {
$fileok = false;
showErrorMessage('Sorry, Your uploaded file size is less than the allowed limit');
exit();
}
$fn = $_FILES[$allowed_s2[0]]['name'];
$fext = substr($fn, strrpos($fn, '.') + 1);
if ( !in_array($fext, $allowed_s3) ) {
$fileok = true;
showErrorMessage('Sorry, Your uploaded file type is not allowed');
exit();
}
if ( $fileok ) {
$uploadedfile = handle_uploaded_files($original_name, $filename);
if ( $uploadedfile ) {
$attachments[$allowed_s2[0]] = $uploadedfile;
}
}
}
}
}
/* Do Onsubmit before_email plugins*/
$ava_plugins = explode(",",$paramsvalues->plugins);
$ava_plugins_order = explode(",",$paramsvalues->mplugins_order);
//$ava_plugins_array = array();
array_multisort($ava_plugins_order, $ava_plugins);
foreach($ava_plugins as $ava_plugin){
$query = "SELECT * FROM #__chrono_contact_plugins WHERE form_id='".$rows[0]->id."' AND event='ONSUBMIT' AND name='".$ava_plugin."'";
$database->setQuery( $query );
$plugins = $database->loadObjectList();
if(count($plugins)){
require_once(JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php");
${$ava_plugin} = new $ava_plugin();
//$params = mosParseParams($plugins[0]->params);
$registry3 = new JRegistry();
$registry3->loadINI( $plugins[0]->params );
$params = $registry3->toObject( );
if($params->onsubmit == 'before_email'){
${$ava_plugin}->onsubmit( 'com_chronocontact', $params, $plugins[0] );
}
}
}
/**
* If there are no errors and e-mail is required then build and send it.
*/
if ( ($rows[0]->emailresults != 0) && !$error_found ) {
/*************** check to see if order was specified, if not then use the default old one ************************/
if((!$paramsvalues->plugins_order)&&(!$paramsvalues->onsubmitcode_order)&&(!$paramsvalues->autogenerated_order)){
$paramsvalues->autogenerated_order=3;
$paramsvalues->onsubmitcode_order=2;
$paramsvalues->plugins_order=1;
}
for($ixx = 1 ; $ixx <= 3; $ixx++){
if($paramsvalues->plugins_order == $ixx){
$ava_plugins = explode(",",$paramsvalues->plugins);
$ava_plugins_order = explode(",",$paramsvalues->mplugins_order);
//$ava_plugins_array = array();
array_multisort($ava_plugins_order, $ava_plugins);
foreach($ava_plugins as $ava_plugin){
$query = "SELECT * FROM #__chrono_contact_plugins WHERE form_id='".$rows[0]->id."' AND event='ONSUBMIT' AND name='".$ava_plugin."'";
$database->setQuery( $query );
$plugins = $database->loadObjectList();
if(count($plugins)){
require_once(JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php");
${$ava_plugin} = new $ava_plugin();
$registry2 = new JRegistry();
$registry2->loadINI( $plugins[0]->params );
$params = $registry2->toObject( );
if($params->onsubmit != 'before_email'){
${$ava_plugin}->onsubmit( 'com_chronocontact', $params , $plugins[0] );
}
}
}
}
/**
* Run the On-submit 'post e-mail' code if there is any
*/
if($paramsvalues->onsubmitcode_order == $ixx){
if ( !empty($rows[0]->onsubmitcode) ) {
eval( "?>".$rows[0]->onsubmitcode );
}
}
/**
* Run the SQL query if there is one
*/
if($paramsvalues->savedataorder == 'after_email'){
if($paramsvalues->autogenerated_order == $ixx){
if ( !empty($rows[0]->autogenerated) ) {
eval( "?>".$rows[0]->autogenerated );
}
}
}
}
/**
* Redirect the page if requested
*/
if ( !empty($rows[0]->redirecturl) ) {
$mainframe->redirect($rows[0]->redirecturl);
}
}
/**
* Send the email(s)
*/
$email_sent = JUtility::sendMail($from, $fromname, $recipient, $subject, $html_message, true,
$ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
if ( $debug ) {
if ($email_sent)echo "Email sent ";
if (!$email_sent)echo "Email not sent ";
}
// :: HACK :: insert debug
if ( $debug ) {
echo "<h4>E-mail message</h4>
<div style='border:1px solid black; padding:6px;margin:6px;'>
<p>From: $fromname [$from]<br />
To: ".implode($recipient,', ')."<br />
Subject: $subject</p>
$html_message<br /></div>";
}
// :: end hack ::
}
if ( !$error_found ) {
/*************** check to see if order was specified, if not then use the default old one ************************/
if((!$paramsvalues->plugins_order)&&(!$paramsvalues->onsubmitcode_order)&&(!$paramsvalues->autogenerated_order)){
$paramsvalues->autogenerated_order=3;
$paramsvalues->onsubmitcode_order=2;
$paramsvalues->plugins_order=1;
}
for($ixx = 1 ; $ixx <= 3; $ixx++){
if($paramsvalues->plugins_order == $ixx){
$ava_plugins = explode(",",$paramsvalues->plugins);
$ava_plugins_order = explode(",",$paramsvalues->mplugins_order);
//$ava_plugins_array = array();
array_multisort($ava_plugins_order, $ava_plugins);
foreach($ava_plugins as $ava_plugin){
$query = "SELECT * FROM #__chrono_contact_plugins WHERE form_id='".$rows[0]->id."' AND event='ONSUBMIT' AND name='".$ava_plugin."'";
$database->setQuery( $query );
$plugins = $database->loadObjectList();
if(count($plugins)){
require_once(JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php");
${$ava_plugin} = new $ava_plugin();
$registry2 = new JRegistry();
$registry2->loadINI( $plugins[0]->params );
$params = $registry2->toObject( );
if($params->onsubmit != 'before_email'){
${$ava_plugin}->onsubmit( 'com_chronocontact', $params , $plugins[0] );
}
}
}
}
/**
* Run the On-submit 'post e-mail' code if there is any
*/
if($paramsvalues->onsubmitcode_order == $ixx){
if ( !empty($rows[0]->onsubmitcode) ) {
eval( "?>".$rows[0]->onsubmitcode );
}
}
/**
* Run the SQL query if there is one
*/
if($paramsvalues->autogenerated_order == $ixx){
if ( !empty($rows[0]->autogenerated) ) {
eval( "?>".$rows[0]->autogenerated );
}
}
/**
* Redirect the page if requested
*/
if ( !empty($rows[0]->redirecturl) ) {
$mainframe->redirect($rows[0]->redirecturl);
}
}
/**
* Handle uploaded files
*
* @param unknown_type $uploadedfile
* @param string $filename
* @param string $limits
* @param string $directory
* @return unknown
*/
function handle_uploaded_files($uploadedfile, $filename, $limits = TRUE, $directory = FALSE)
{
//global $mosConfig_absolute_path, $mosConfig_fileperms;
//$fileperms = "0644";
/*if ( strlen($mosConfig_fileperms) > 0 ) {
$fileperms = octdec($mosConfig_fileperms);
}*/
$uploaded_files = "";
$upload_path = JPATH_SITE.'/components/com_chronocontact/upload/';
if ( is_file($uploadedfile) ) {
$targetfile = $upload_path.$filename;
while ( file_exists($targetfile) ) {
$targetfile = $upload_path.rand(1,1000).'_'.$filename;
}
move_uploaded_file($uploadedfile, $targetfile);
//if ( strlen($fileperms) > 0 ) {
// chmod($targetfile, $fileperms);
//}
$uploaded_files = $targetfile;
}
return $uploaded_files;
}
/**
* Display JavaScript alert box as error message
*
* @param string $message
*/
function showErrorMessage($message) {
echo "<script> alert('$message'); </script>\n";
}
?>
I followed your instructions but im getting error on the script line 470
Which is something to do with the parameters i think.
What else did you do?
This problem has been bugging for awhile.
Thanks in advance if someone with more php knowledge can fix this problem for me.
Heres my script
<?php
/**
* CHRONOFORMS version 1.0 stable
* Copyright (c) 2006 Chrono_Man, ChronoEngine.com. All rights reserved.
* Author: Chrono_Man (ChronoEngine.com)
* See readme.html.
* Visit http://www.ChronoEngine.com for regular update and information.
**/
/* ensure that this file is called by another file */
defined('_JEXEC') or die('Restricted access');
/**
* Load the HTML class
*/
require_once( JApplicationHelper::getPath( 'front_html' ) );
require_once( JApplicationHelper::getPath( 'class' ) );
$posted = array();
$posted = $_POST;
/**
* Main switch statement
*/
switch( $task ) {
case 'send':
uploadandmail();
break;
default:
showform($posted);
break;
}
/**
* End of main page
*
*/
/**
* Display the form for entry
*
*/
function showform($posted)
{
global $mainframe;
$database =& JFactory::getDBO();
$formname = JRequest::getVar( 'chronoformname', '', 'get', 'string', '' );
//$formname = $_GET['chronoformname'];
if ( !$formname ) {
$query = "
SELECT params
FROM #__menu
WHERE id='".$_GET['Itemid']."' AND type='component'";
$database->setQuery( $query );
$menudata = $database->loadResult();
if ( $menudata ) {
$registry = new JRegistry();
$registry->loadINI( $menudata );
$configs = $registry->toObject( );
$formname = $configs->formname;
}
}
$imver = "";
$query = "
SELECT *
FROM #__chrono_contact
WHERE name = '$formname'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$registry = new JRegistry();
$registry->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry->toObject( );
if ( trim($paramsvalues->imagever) == 'Yes' ) {
$imver = '<input name="chrono_verification" type="text" id="chrono_verification" value="">
  <img src="'.JURI::Base()
.'components/com_chronocontact/chrono_verification.php?imtype='.$paramsvalues->imtype.'">';
}
$htmlstring = $rows[0]->html;
if( trim($paramsvalues->validate) == 'Yes'){
// Easy Validation //
preg_match_all('/name=("|\').*?("|\')/i', $htmlstring, $matches);
$arr_required = explode(",", str_replace(" ","",$paramsvalues->val_required));
$arr_validate_number = explode(",", str_replace(" ","",$paramsvalues->val_validate_number));
$arr_validate_digits = explode(",", str_replace(" ","",$paramsvalues->val_validate_digits));
$arr_validate_alpha = explode(",", str_replace(" ","",$paramsvalues->val_validate_alpha));
$arr_validate_alphanum = explode(",", str_replace(" ","",$paramsvalues->val_validate_alphanum));
$arr_validate_date = explode(",", str_replace(" ","",$paramsvalues->val_validate_date));
$arr_validate_email = explode(",", str_replace(" ","",$paramsvalues->val_validate_email));
$arr_validate_url = explode(",", str_replace(" ","",$paramsvalues->val_validate_url));
$arr_validate_date_au = explode(",", str_replace(" ","",$paramsvalues->val_validate_date_au));
$arr_validate_currency_dollar = explode(",", str_replace(" ","",$paramsvalues->val_validate_currency_dollar));
$arr_validate_selection = explode(",", str_replace(" ","",$paramsvalues->val_validate_selection));
$arr_validate_one_required = explode(",", str_replace(" ","",$paramsvalues->val_validate_one_required));
$arr_all = array_merge($arr_required, $arr_validate_number, $arr_validate_digits, $arr_validate_alpha, $arr_validate_alphanum, $arr_validate_date, $arr_validate_email, $arr_validate_url, $arr_validate_date_au,
$arr_validate_currency_dollar, $arr_validate_selection, $arr_validate_one_required);
foreach ($matches[0] as $match)
{
$new_match = preg_replace('/name=("|\')/i', '', $match);
$new_match2 = preg_replace('/("|\')/', '', $new_match);
$name = preg_replace('/name=("|\')/', '', $new_match2);
$class_array = array();
if(in_array($name,$arr_all)){
if(in_array($name,$arr_required)){
$class_array[] = "required";
}
if(in_array($name,$arr_validate_number)){
$class_array[] = "validate-number";
}
if(in_array($name,$arr_validate_digits)){
$class_array[] = "validate-digits";
}
if(in_array($name,$arr_validate_alpha)){
$class_array[] = "validate-alpha";
}
if(in_array($name,$arr_validate_alphanum)){
$class_array[] = "validate-alphanum";
}
if(in_array($name,$arr_validate_date)){
$class_array[] = "validate-date";
}
if(in_array($name,$arr_validate_email)){
$class_array[] = "validate-email";
}
if(in_array($name,$arr_validate_url)){
$class_array[] = "validate-url";
}
if(in_array($name,$arr_validate_date_au)){
$class_array[] = "validate-date-au";
}
if(in_array($name,$arr_validate_currency_dollar)){
$class_array[] = "validate-currency-dollar";
}
if(in_array($name,$arr_validate_selection)){
$class_array[] = "validate-selection";
}
if(in_array($name,$arr_validate_one_required)){
$class_array[] = "validate-one-required";
}
$class_string = implode(" ",$class_array);
$htmlstring = str_replace($match,$match.' class="'.$class_string.'"',$htmlstring);
}
}
$rows[0]->html = $htmlstring;
}
/// end validation //
HTML_ChronoContact::showform( $rows , $imver);
}
/**
* Respond to a submitted form
*
*/
function uploadandmail()
{
global $mainframe;
$database =& JFactory::getDBO();
// Block SPAM through the submit URL
if ( empty($_POST) ) {
echo "You are not allowed to access this URL directly, POST array is empty";
return;
}
/**
* Retrieve form data from the database
*/
$formname = JRequest::getVar( 'chronoformname', '', 'get', 'string', '' );
//$formname = $_GET['chronoformname'];
$query = "
SELECT *
FROM #__chrono_contact
WHERE name='$formname'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$registry = new JRegistry();
$registry->loadINI( $rows[0]->titlesall );
$titlesvalues = $registry->toObject( );
$registry = new JRegistry();
$registry->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry->toObject( );
$error_found = false;
/**
* If imageversification is on check the code
*/
if ( trim($paramsvalues->imagever) == 'Yes' ) {
/*if (session_name() != md5('chrono')){
session_write_close();
}
session_name(md5('chrono'));
*/
//session_start();
$session =& JFactory::getSession();
$sessionvar = $session->get('chrono_verification', 'default', md5('chrono'));
$chrono_verification = strtolower($_POST['chrono_verification']);
if ( md5($chrono_verification ) != $sessionvar ) {
showErrorMessage('Sorry, You have entered a wrong verification code, Please try again!!');
showform($_POST);
return;
}else{
unset($_SESSION['chrono_verification']);
}
}
/**
* if $debug is true then ChronoForms will show diagnostic output
*/
$debug = $paramsvalues->debug;
if ( $debug ) {
echo "_POST: ";
print_r($_POST);
echo "<br />";
}
/**
* Upload attachments
*/
$attachments = array();
if ( trim($paramsvalues->uploads == 'Yes' ) && trim($paramsvalues->uploadfields) ) {
//$allowed_s1 = explode(",", trim($paramsvalues->uploadfields));
if ( is_array($paramsvalues->uploadfields) ) {
$allowed_s1 = implode('|', $paramsvalues->uploadfields);
} else {
$allowed_s1 = $paramsvalues->uploadfields;
}
$allowed_s1 = explode(",", trim($allowed_s1));
foreach ( $allowed_s1 as $allowed_1 ) {
$allowed_s2 = explode(":", trim($allowed_1));
$allowed_s3 = explode("|", trim($allowed_s2[1]));
$original_name = $_FILES[$allowed_s2[0]]['tmp_name'];
$filename = date('YmdHis').'_'.preg_replace('`[^a-z0-9-_.]`i','',$_FILES[$allowed_s2[0]]['name']);
$fileok = true;
if ( $original_name ) {
if ( ($_FILES[$allowed_s2[0]]["size"] / 1024) > trim($paramsvalues->uploadmax) ) {
$fileok = false;
showErrorMessage('Sorry, Your uploaded file size exceeds the allowed limit.');
exit();
}
if ( ($_FILES[$allowed_s2[0]]["size"] / 1024) < trim($paramsvalues->uploadmin) ) {
$fileok = false;
showErrorMessage('Sorry, Your uploaded file size is less than the allowed limit');
exit();
}
$fn = $_FILES[$allowed_s2[0]]['name'];
$fext = substr($fn, strrpos($fn, '.') + 1);
if ( !in_array($fext, $allowed_s3) ) {
$fileok = true;
showErrorMessage('Sorry, Your uploaded file type is not allowed');
exit();
}
if ( $fileok ) {
$uploadedfile = handle_uploaded_files($original_name, $filename);
if ( $uploadedfile ) {
$attachments[$allowed_s2[0]] = $uploadedfile;
}
}
}
}
}
/* Do Onsubmit before_email plugins*/
$ava_plugins = explode(",",$paramsvalues->plugins);
$ava_plugins_order = explode(",",$paramsvalues->mplugins_order);
//$ava_plugins_array = array();
array_multisort($ava_plugins_order, $ava_plugins);
foreach($ava_plugins as $ava_plugin){
$query = "SELECT * FROM #__chrono_contact_plugins WHERE form_id='".$rows[0]->id."' AND event='ONSUBMIT' AND name='".$ava_plugin."'";
$database->setQuery( $query );
$plugins = $database->loadObjectList();
if(count($plugins)){
require_once(JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php");
${$ava_plugin} = new $ava_plugin();
//$params = mosParseParams($plugins[0]->params);
$registry3 = new JRegistry();
$registry3->loadINI( $plugins[0]->params );
$params = $registry3->toObject( );
if($params->onsubmit == 'before_email'){
${$ava_plugin}->onsubmit( 'com_chronocontact', $params, $plugins[0] );
}
}
}
/**
* If there are no errors and e-mail is required then build and send it.
*/
if ( ($rows[0]->emailresults != 0) && !$error_found ) {
/*************** check to see if order was specified, if not then use the default old one ************************/
if((!$paramsvalues->plugins_order)&&(!$paramsvalues->onsubmitcode_order)&&(!$paramsvalues->autogenerated_order)){
$paramsvalues->autogenerated_order=3;
$paramsvalues->onsubmitcode_order=2;
$paramsvalues->plugins_order=1;
}
for($ixx = 1 ; $ixx <= 3; $ixx++){
if($paramsvalues->plugins_order == $ixx){
$ava_plugins = explode(",",$paramsvalues->plugins);
$ava_plugins_order = explode(",",$paramsvalues->mplugins_order);
//$ava_plugins_array = array();
array_multisort($ava_plugins_order, $ava_plugins);
foreach($ava_plugins as $ava_plugin){
$query = "SELECT * FROM #__chrono_contact_plugins WHERE form_id='".$rows[0]->id."' AND event='ONSUBMIT' AND name='".$ava_plugin."'";
$database->setQuery( $query );
$plugins = $database->loadObjectList();
if(count($plugins)){
require_once(JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php");
${$ava_plugin} = new $ava_plugin();
$registry2 = new JRegistry();
$registry2->loadINI( $plugins[0]->params );
$params = $registry2->toObject( );
if($params->onsubmit != 'before_email'){
${$ava_plugin}->onsubmit( 'com_chronocontact', $params , $plugins[0] );
}
}
}
}
/**
* Run the On-submit 'post e-mail' code if there is any
*/
if($paramsvalues->onsubmitcode_order == $ixx){
if ( !empty($rows[0]->onsubmitcode) ) {
eval( "?>".$rows[0]->onsubmitcode );
}
}
/**
* Run the SQL query if there is one
*/
if($paramsvalues->savedataorder == 'after_email'){
if($paramsvalues->autogenerated_order == $ixx){
if ( !empty($rows[0]->autogenerated) ) {
eval( "?>".$rows[0]->autogenerated );
}
}
}
}
/**
* Redirect the page if requested
*/
if ( !empty($rows[0]->redirecturl) ) {
$mainframe->redirect($rows[0]->redirecturl);
}
}
/**
* Send the email(s)
*/
$email_sent = JUtility::sendMail($from, $fromname, $recipient, $subject, $html_message, true,
$ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
if ( $debug ) {
if ($email_sent)echo "Email sent ";
if (!$email_sent)echo "Email not sent ";
}
// :: HACK :: insert debug
if ( $debug ) {
echo "<h4>E-mail message</h4>
<div style='border:1px solid black; padding:6px;margin:6px;'>
<p>From: $fromname [$from]<br />
To: ".implode($recipient,', ')."<br />
Subject: $subject</p>
$html_message<br /></div>";
}
// :: end hack ::
}
if ( !$error_found ) {
/*************** check to see if order was specified, if not then use the default old one ************************/
if((!$paramsvalues->plugins_order)&&(!$paramsvalues->onsubmitcode_order)&&(!$paramsvalues->autogenerated_order)){
$paramsvalues->autogenerated_order=3;
$paramsvalues->onsubmitcode_order=2;
$paramsvalues->plugins_order=1;
}
for($ixx = 1 ; $ixx <= 3; $ixx++){
if($paramsvalues->plugins_order == $ixx){
$ava_plugins = explode(",",$paramsvalues->plugins);
$ava_plugins_order = explode(",",$paramsvalues->mplugins_order);
//$ava_plugins_array = array();
array_multisort($ava_plugins_order, $ava_plugins);
foreach($ava_plugins as $ava_plugin){
$query = "SELECT * FROM #__chrono_contact_plugins WHERE form_id='".$rows[0]->id."' AND event='ONSUBMIT' AND name='".$ava_plugin."'";
$database->setQuery( $query );
$plugins = $database->loadObjectList();
if(count($plugins)){
require_once(JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php");
${$ava_plugin} = new $ava_plugin();
$registry2 = new JRegistry();
$registry2->loadINI( $plugins[0]->params );
$params = $registry2->toObject( );
if($params->onsubmit != 'before_email'){
${$ava_plugin}->onsubmit( 'com_chronocontact', $params , $plugins[0] );
}
}
}
}
/**
* Run the On-submit 'post e-mail' code if there is any
*/
if($paramsvalues->onsubmitcode_order == $ixx){
if ( !empty($rows[0]->onsubmitcode) ) {
eval( "?>".$rows[0]->onsubmitcode );
}
}
/**
* Run the SQL query if there is one
*/
if($paramsvalues->autogenerated_order == $ixx){
if ( !empty($rows[0]->autogenerated) ) {
eval( "?>".$rows[0]->autogenerated );
}
}
/**
* Redirect the page if requested
*/
if ( !empty($rows[0]->redirecturl) ) {
$mainframe->redirect($rows[0]->redirecturl);
}
}
/**
* Handle uploaded files
*
* @param unknown_type $uploadedfile
* @param string $filename
* @param string $limits
* @param string $directory
* @return unknown
*/
function handle_uploaded_files($uploadedfile, $filename, $limits = TRUE, $directory = FALSE)
{
//global $mosConfig_absolute_path, $mosConfig_fileperms;
//$fileperms = "0644";
/*if ( strlen($mosConfig_fileperms) > 0 ) {
$fileperms = octdec($mosConfig_fileperms);
}*/
$uploaded_files = "";
$upload_path = JPATH_SITE.'/components/com_chronocontact/upload/';
if ( is_file($uploadedfile) ) {
$targetfile = $upload_path.$filename;
while ( file_exists($targetfile) ) {
$targetfile = $upload_path.rand(1,1000).'_'.$filename;
}
move_uploaded_file($uploadedfile, $targetfile);
//if ( strlen($fileperms) > 0 ) {
// chmod($targetfile, $fileperms);
//}
$uploaded_files = $targetfile;
}
return $uploaded_files;
}
/**
* Display JavaScript alert box as error message
*
* @param string $message
*/
function showErrorMessage($message) {
echo "<script> alert('$message'); </script>\n";
}
?>
Edit
I am having the could not instatiate main function error on 3.0 so i installed 2.5 and it didnt work then i found this.
Now joomla mail setting are set correct cause i am using Qcontacts which sends mail to people, and when i create account they get email saying there account has been created.
using joomla 1.5.6 and 2.5 chrono.
I am having the could not instatiate main function error on 3.0 so i installed 2.5 and it didnt work then i found this.
Now joomla mail setting are set correct cause i am using Qcontacts which sends mail to people, and when i create account they get email saying there account has been created.
using joomla 1.5.6 and 2.5 chrono.
Hi Benny,
try the SMTP option at Joomla and or, try to attach some file to the email, add a file upload field and configure the file uploads tab and see if it emails with file attached ? if you are open to this idea, PM me some admin access to your website and I will test, I will need V3.0 BETA 2 installed though!
Regards,
Max
try the SMTP option at Joomla and or, try to attach some file to the email, add a file upload field and configure the file uploads tab and see if it emails with file attached ? if you are open to this idea, PM me some admin access to your website and I will test, I will need V3.0 BETA 2 installed though!
Regards,
Max
Hey Max
I tried the Upload and said Could not instantiate mail function. I'm on a windows 2003 with Apache and myadmin running, the SMTP is already set up its looking towards our exchange, and unfortunately it is an intranet so its not going out to the world, It working fine on other things just not this. Do i need the cf_Authorize_dotnet_J1.5.zip or the mambot to make this work? or is there something else wrong?
[attachment=0]Email Working.JPG[/attachment]
I tried the Upload and said Could not instantiate mail function. I'm on a windows 2003 with Apache and myadmin running, the SMTP is already set up its looking towards our exchange, and unfortunately it is an intranet so its not going out to the world, It working fine on other things just not this. Do i need the cf_Authorize_dotnet_J1.5.zip or the mambot to make this work? or is there something else wrong?
[attachment=0]Email Working.JPG[/attachment]
Hi Benny,
you don't need anything else to get it working, what about this image, it says Thank you but actually do you get the email in your inbox ? I'm not sure how you have this setup but I suggest you test the joomla mails to a gmail for example and then test Chronoforms for the same gmail inbox ?
you don't need anything else to get it working, what about this image, it says Thank you but actually do you get the email in your inbox ? I'm not sure how you have this setup but I suggest you test the joomla mails to a gmail for example and then test Chronoforms for the same gmail inbox ?
O ok sorry i didnt explain that picture better, thats a picture of the mail working with another joomla extension.
ill try explaining my setup to you, im running a windows 2003 server with Apache with mysql and myphpadmin installed running joomla 1.5.6 i have the mail setting for joomla point to the exchange 2007 server located here and it is sending mass mail, contact emails fine,
Tried setting gmail as my smtp server but it did not work. i have allowed the server to accept stmp requests in the exchange aswell, i cant think of anything else stopping it.
ill try explaining my setup to you, im running a windows 2003 server with Apache with mysql and myphpadmin installed running joomla 1.5.6 i have the mail setting for joomla point to the exchange 2007 server located here and it is sending mass mail, contact emails fine,
Tried setting gmail as my smtp server but it did not work. i have allowed the server to accept stmp requests in the exchange aswell, i cant think of anything else stopping it.
As well i tried my setting that work with other extensions sending from a gmail account with chronoforms and it comes up with the same Could not instantiate mail function error
Hi everyone,
This seems to still be an issue. I'm not real sure what I did to get this to work. I edited just two php files from the chronocontact folder. I would be glad to upload those files and anyone can look at themselves but I am new to this forum and have been unable to upload php files at this point. If someone wants to tell me how to upload these files I would be glad to do so
Serta
This seems to still be an issue. I'm not real sure what I did to get this to work. I edited just two php files from the chronocontact folder. I would be glad to upload those files and anyone can look at themselves but I am new to this forum and have been unable to upload php files at this point. If someone wants to tell me how to upload these files I would be glad to do so
Serta
Hi Serta,
you can compress them into zip and upload.
@Benny, I just fixed the couldn't instantiate issue for a user and I found that his email config is wrong, he was using ";" to separate emails and had "[" in the from name, well, to test emails, make only one email first, with To, Subject, From Email, From name
To : [email]somebody@gmail.com[/email]
Subject : my subject
From name : Admin
From Email : [email]admin@admin.com[/email]
change the "To" only to your email and not anything else until you are sure all is working fine!
keep me updated!
you can compress them into zip and upload.
@Benny, I just fixed the couldn't instantiate issue for a user and I found that his email config is wrong, he was using ";" to separate emails and had "[" in the from name, well, to test emails, make only one email first, with To, Subject, From Email, From name
To : [email]somebody@gmail.com[/email]
Subject : my subject
From name : Admin
From Email : [email]admin@admin.com[/email]
change the "To" only to your email and not anything else until you are sure all is working fine!
keep me updated!
I have always only been sending to one person which is me, if you could upload those php files serta, so i can take a look at them i would be much appreciated
Just can figure it out. could it be the exchange? cause i have tried with the gmail account but it did not work.
Just can figure it out. could it be the exchange? cause i have tried with the gmail account but it did not work.
Hi Benny,
okay, you was sending to your email but what was your from name and from email ?
okay, you was sending to your email but what was your from name and from email ?
From name was just my username on joomla and it was from the same email that joomla uses, i created a separate email for it.
make the from name : admin, from email : [email]admin@admin.com[/email], test ?
I should have thought of that.
Well here is the zip file with the two files that I had to edit to resolve this issue, hope it helps.
serta
Well here is the zip file with the two files that I had to edit to resolve this issue, hope it helps.
serta
Thanks so much Serta it works perfectly
Couldnt not make it work but, your files did, Thanks a million.
Also might have been the from name i put admin at the same time, so thanks for the help to Max.
Couldnt not make it work but, your files did, Thanks a million.
Also might have been the from name i put admin at the same time, so thanks for the help to Max.
Thanks Benny, I didn't check serta's code yet but it seems that the issue location has been identified while debugging with another user, I strongly recommend that you upgrade with the next release, it should not take much time before I release it.
Regards
Max
Regards
Max
Hello Max,
After being able to send emails I have now ran into another problem...that is saving data from a form into the database. I have done a little research and while doing so have come to the conclusion that these problems are related. If you want to save the database you cannot email and vice versa. I have been going through the code and have come down to this little bit of code in the chronocontact.php file that is directly related to this issue. Depending on whether I include or exclude this bit of code the email or db connection will work. The code begins on line 41 in my chronocontact.php and I here it is:
$query = "SELECT * FROM #__chrono_contact WHERE name = '$formname'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$registry = new JRegistry();
$registry->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry->toObject( );
if($paramsvalues->dbconnection == "Yes"){
eval ("?>".$rows[0]->dbclasses);
}
It seems to be a problem with variable names I changed the variable names like below and both email and saving to the database works.
$query1 = "SELECT * FROM #__chrono_contact WHERE name = '$formname'";
$database->setQuery( $query1 );
$rows = $database->loadObjectList();
$registry1 = new JRegistry();
$registry1->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry1->toObject( );
if($paramsvalues->dbconnection == "Yes"){
eval ("?>".$rows[0]->dbclasses);
}
I just added a 1 after the variable names that were used in the lines above it. It will save to the database but for some reason now mine will save it twice in my database.
You seem to be apart of chronoengine's development team so I hope this helps.
serta
After being able to send emails I have now ran into another problem...that is saving data from a form into the database. I have done a little research and while doing so have come to the conclusion that these problems are related. If you want to save the database you cannot email and vice versa. I have been going through the code and have come down to this little bit of code in the chronocontact.php file that is directly related to this issue. Depending on whether I include or exclude this bit of code the email or db connection will work. The code begins on line 41 in my chronocontact.php and I here it is:
$query = "SELECT * FROM #__chrono_contact WHERE name = '$formname'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$registry = new JRegistry();
$registry->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry->toObject( );
if($paramsvalues->dbconnection == "Yes"){
eval ("?>".$rows[0]->dbclasses);
}
It seems to be a problem with variable names I changed the variable names like below and both email and saving to the database works.
$query1 = "SELECT * FROM #__chrono_contact WHERE name = '$formname'";
$database->setQuery( $query1 );
$rows = $database->loadObjectList();
$registry1 = new JRegistry();
$registry1->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry1->toObject( );
if($paramsvalues->dbconnection == "Yes"){
eval ("?>".$rows[0]->dbclasses);
}
I just added a 1 after the variable names that were used in the lines above it. It will save to the database but for some reason now mine will save it twice in my database.
You seem to be apart of chronoengine's development team so I hope this helps.
serta
Hi Serta,
I believe you are SuperMan, thanks for the great info! 😀
I was just debugging this piece of code with another user which had the same issue of the email "could not instantiate ...." and we reached to the result that before the line
so I believe that if you got the original BETA 2 now and replaced the same piece in chronocontact.php then all will be fine without your hack too.
so your problem now is that data gets saved twice ?
Max
I believe you are SuperMan, thanks for the great info! 😀
I was just debugging this piece of code with another user which had the same issue of the email "could not instantiate ...." and we reached to the result that before the line
$registry = new JRegistry();
everything is fine, so now you solves it, because this code is loaded out of the functions, it seems like another Joomla core thing uses the same variable name and so this makes a problem for some users or maybe even another extension.so I believe that if you got the original BETA 2 now and replaced the same piece in chronocontact.php then all will be fine without your hack too.
so your problem now is that data gets saved twice ?
Max
Well that did it perfectly.
On an update to my previous post I have went back to the original chrono forms version 3 beta 2 installation files without my previous hack that mixed version 3 with version 2.5. This time all I did was replace the one section of code that was conflicting with the variable names.
So to be specific I replaced the following code beginning on line 41 of the chronocontact.php file:
$query = "SELECT * FROM #__chrono_contact WHERE name = '$formname'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$registry = new JRegistry();
$registry->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry->toObject( );
if($paramsvalues->dbconnection == "Yes"){
eval ("?>".$rows[0]->dbclasses);
}
With this code:
$query1 = "SELECT * FROM #__chrono_contact WHERE name = '$formname'";
$database->setQuery( $query1 );
$rows = $database->loadObjectList();
$registry1 = new JRegistry();
$registry1->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry1->toObject( );
if($paramsvalues->dbconnection == "Yes"){
eval ("?>".$rows[0]->dbclasses);
}
And now everything works perfectly. I no longer get the "could not instantiate mail function" message and email goes through perfectly and I am still able to save my form data to my database. I previously stated that my form data was being saved twice in my database but by doing this that is no longer an issue also. So this this should do it for anyone who has this problem just replace the above lines of code with the code I provided and no more problem.
Thanks Max and everyone for your help in resolving this issue.
serta
On an update to my previous post I have went back to the original chrono forms version 3 beta 2 installation files without my previous hack that mixed version 3 with version 2.5. This time all I did was replace the one section of code that was conflicting with the variable names.
So to be specific I replaced the following code beginning on line 41 of the chronocontact.php file:
$query = "SELECT * FROM #__chrono_contact WHERE name = '$formname'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
$registry = new JRegistry();
$registry->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry->toObject( );
if($paramsvalues->dbconnection == "Yes"){
eval ("?>".$rows[0]->dbclasses);
}
With this code:
$query1 = "SELECT * FROM #__chrono_contact WHERE name = '$formname'";
$database->setQuery( $query1 );
$rows = $database->loadObjectList();
$registry1 = new JRegistry();
$registry1->loadINI( $rows[0]->paramsall );
$paramsvalues = $registry1->toObject( );
if($paramsvalues->dbconnection == "Yes"){
eval ("?>".$rows[0]->dbclasses);
}
And now everything works perfectly. I no longer get the "could not instantiate mail function" message and email goes through perfectly and I am still able to save my form data to my database. I previously stated that my form data was being saved twice in my database but by doing this that is no longer an issue also. So this this should do it for anyone who has this problem just replace the above lines of code with the code I provided and no more problem.
Thanks Max and everyone for your help in resolving this issue.
serta
Thank you serta for the tutorial!🙂
Max
Max
This was the only thread that related to my problem....slightly. Basically, it's just not working. I successfully installed it and setup a form. I'm not getting any error messages, like "could not instantiate". It's just that I'm not getting any emails from my form....I already checked the email account and it is working. It does receive emails. I setup the form using Form Wizard making sure to use the same email that I have in Global Configuration.
using:
Joomla 1.5 Legacy Mode
ChronoForms v3 Stable
URL: http://www.txwebdesigners.com/index.php/contact-us/email
I tried using PHP Mailer. That didn't work. So I then tried using SMTP. That didn't work.
Any clues as to what I may be doing wrong? I have the same configuration that "Serta" shows above in his screenshots...???
I'd really rather not get into editing code via FTP. I'd like a product that can work "out of box" if I'm going to pay for it in the end....
Thanks in Advance!
using:
Joomla 1.5 Legacy Mode
ChronoForms v3 Stable
URL: http://www.txwebdesigners.com/index.php/contact-us/email
I tried using PHP Mailer. That didn't work. So I then tried using SMTP. That didn't work.
Any clues as to what I may be doing wrong? I have the same configuration that "Serta" shows above in his screenshots...???
I'd really rather not get into editing code via FTP. I'd like a product that can work "out of box" if I'm going to pay for it in the end....
Thanks in Advance!
Hi tysonbravo,
the hacks above was fixes for the beta release and V3.0 stable is working out of the box, did you take a look at the emails setup tutorials in our downloads page ? please check this one and let me know if it doesn't solve it!
Cheers,
Max
the hacks above was fixes for the beta release and V3.0 stable is working out of the box, did you take a look at the emails setup tutorials in our downloads page ? please check this one and let me know if it doesn't solve it!
Cheers,
Max
Hi tysonbravo,
Email is working from your site and ChronoForms uses the site email set up so there should be no problem.
FAQ "My e-mails aren't being sent" has some other suggestions for things to check.
Bob
Email is working from your site and ChronoForms uses the site email set up so there should be no problem.
FAQ "My e-mails aren't being sent" has some other suggestions for things to check.
Bob
Thanks you guys! It's working now. I think it was just that I didn't click "enabled" when I was setting up my emails. That or the fact that I had the same email address in the to and from fields.
This topic is locked and no more replies can be posted.