How to send an email to the recieptients or the user? example: after submitting the form there will be an email being send to my mail and confirm that ive registered the form already. how to do this tnx
Jan
add a "dynamic To" and add the field name which will hole the email address of the recipient!
Regards
Max
Thanks problem solve:) Thank you very much
Another question:
How im going to put the auto increment "cf_id" in the reply message?
Like for example i just want to say like this:
Dear {FirstName }
your ID number is : {cf_id}
now when it try to do that the output is like this:
Dear Test,
your ID number is: {cf_id}? my question is why is it that the cf_id didnot work? the out is still the same it doesnt give me the value of cf_id?
Jan
The quick answer is that cf-id isn't defined until the data is saved in the database table. So to include the cf_id you'll need to add code to the end of the Autogenerated code to look up the ID and send an email.
I think that we discussed this quite a lot a few months ago and if you search through the forums you should find some examples - though maybe for the older version of ChronoForms and I'm not sure that they will work with the current version which uses a different approach to saving the data.
Bob
I need this feature too...but couldn't find the relevant posts. Could you point me to the right direction...
So I need the database ID included in the auto responder email and at the moment I use this script in the onsubmit code after email section:
<?php
$from ="mymail@mymail.co.uk";
$fromname = "ATTI";
$recipient = $_POST['email'];
$subject = "Ticket Registration";
$html_message = "<p>Hi, Thank you for contacting me, I will respond as soon as possible.</p>";
mosMail($from, $fromname, $recipient, $subject, $html_message, true,$ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
?>
What extra codes I should add to include the ID number?Thanks for your help...
mojohand
Regards
Max
Just to add to Max's post - please be clear what ID you want to add? Is it really the CF_id or the user id - or something else?
Bob
Hi,
Just to add to Max's post - please be clear what ID you want to add? Is it really the CF_id or the user id - or something else?
Bob
Helo Bob & Max,
Thanks for the reply, i just want to make it clear. the said "cf_id, uid, recordtime,ipaddress,cf_user_id" when we create a data table that 5 data field name is already made. and i also notice that this "cf-id" is my primary key and the auto increament. so everytime that users filled my form has its auto generated cf_id. so what i want is, if im going to set a email message to the recipients it will also automatically declare the cf_id, like what i said previously that if if im going to say" Dear {FirstName} the result will be " "DEAR NAME OF THE USERS" so same as the cf_id when im going to put like this " YOUR ID NUMBER IS {cf_id} the result is still like this {cf_id} it ddnt give me the exact value of "cf_id". thanks i hope i made it clear i hope you got my point.
jan
Thanks very much that you take time for this.
In the auto respond email I would like to include the ID of the database entry that is created and visible at the backend. Starting withname: Record 1 and incrementing 2,3,4 etc.
If click on the record it is on the top with name: cf_id
My autogenerated code is:
<?php
global $database;
$database->setQuery( "INSERT INTO #__chronoforms_1 VALUES (
'' , '". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' , '".$_POST['company_name']."' , '".$_POST['address']."' , '".$_POST['city']."' , '".$_POST['postcode']."' , '".$_POST['country']."' , '".$_POST['email']."' , '".$_POST['phone']."' , '".$_POST['fax']."' , '".$_POST['website']."' , '".$_POST['ticket_name_1']."' , '".$_POST['position_1']."' , '".$_POST['ticket_name_2']."' , '".$_POST['position_2']."' , '".$_POST['ticket_name_3']."' , '".$_POST['position_3']."' , '".$_POST['ticket_name_4']."' , '".$_POST['position_4']."' , '".$_POST['ticket_name_5']."' , '".$_POST['position_5']."' , '".$_POST['ticket_name_6']."' , '".$_POST['position_6']."' , '".$_POST['ticket_name_7']."' , '".$_POST['position_7']."' , '".$_POST['wholesaler']."' , '".$_POST['distributor']."' , '".$_POST['agent']."' , '".$_POST['retailer']."' , '".$_POST['manufacturer']."' , '".$_POST['press']."' , '".$_POST['other_specify']."' , '".$_POST['no_employees']."' , '".$_POST['yearly_turnover']."' , '".$_POST['require_hotel_info']."' , '".$_POST['invite_letter_request']."' , '".$_POST['purpose_visiting']."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
Show me your Autogen code and I will try to help.
@mojohand, you have Joomla 1.0, so this must be done the old way, there are some posts here about this, it has the "nextid" or something! take alook and let us know!
Regards
Max
Here is my Autogenerated Codes:
<?php
if($paramsvalues->dbconnection == "Yes"){
$user = JFactory::getUser();
$row =& JTable::getInstance("chronoforms_Final_Form_App2", "Table");
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );
if (!$row->bind( $post )) {
JError::raiseWarning(100, $row->getError());
}
if (!$row->store()) {
JError::raiseWarning(100, $row->getError());
}
global $row_jos_chronoforms_Final_Form_App2;
$row_jos_chronoforms_Final_Form_App2 = $row;
}
?>
after the record is saved use:
<?php
echo $row_jos_chronoforms_Final_Form_App2->cf_id;
?>
to get the value, so you need to make the auto generated code BEFORE email !
Regards
Max
Can you please guide me where im suppose to put that code? coz i try to place that in before sending email box, and then still the same, its not working. im i missing something or im in wrong path.
jan
I searched the forum all over but couldn't find the solution... nothing comes up with nextid....or cf_id...
you need to make the auto generated code itself before email, this is a setting in the Auto generated tab I think!
@mojohand,
try insertId too!
please make another search, I couldn't find it quickly too, or you can search joomla forums for next id and you may find this code there, its a Joomla line of code!
let me know what you do!
Regards
Max
I dont get it, what i did is i set a code in the email template box.
jan
let me know!
Max
I need send cf_id to email too...
I tried all things but It's not clear to me...
PS: The content of Auto generated field, when I saved, was overwritte by default code. So I can't change this code...
===
Update 1: About my PS, It's bug in 3.0: http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=3&t=12026&p=19981&hilit=autogenerated#p19981
Regards
Max
<?php
if($paramsvalues->dbconnection == "Yes"){
$user = JFactory::getUser();
$row =& JTable::getInstance("chronoforms_credit", "Table");
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );
if (!$row->bind( $post )) {
JError::raiseWarning(100, $row->getError());
}
if (!$row->store()) {
JError::raiseWarning(100, $row->getError());
}
global $row_jos_chronoforms_credit;
$row_jos_chronoforms_credit = $row;
}
?>
I know that in autogenerated field is not possible edit the text. I found where is generated this code (admin.chronocontact.php).
I created a tag in template email: {cf_id}.
It's necessary fill it... Thank for your help.
set the Autogenerated code to run "before email", then at your email template, add this PHP code:
<?php
global $row_jos_chronoforms_credit;
echo $row_jos_chronoforms_credit->cf_id;
?>
note that you may need to disable the editor per the template!
regards
Max
I tried disable in Global Configuration(no editor) and unpublish the plugin: Editor - TinyMCE 2.0, but, no result.
The Chronoforms component load the editor!
Regards
Max
Select the form
In Setup Email tab, select the Container (green box), it will open the Email Properties.
Select No in Use Template.
Press Aply (button bellow), after press Save. This process will disable the editor.
Select the form again
In E-mails Templates tab, Email Template will appear only text.
Include this code:
<?php
global $row_jos_chronoforms_name;
echo $row_jos_chronoforms_name->cf_id;
?>
To recovery the value of cf_id!!!
Perfect! Perfect! Perfect!!! Thanks a lot!
add a "dynamic To" and add the field name which will hold the email address of the recipient!
I am trying to use the data entered form the form but maybe I am misunderstanding how this works.
When adding a new email container under "Setup Emails"
I add "dynamic To" and in the filed enter {email} (Which is the id and name of the field in my form) - This causes "500 Internal Error"
IF
I add "dynamic Subject" {f_name} has made a request - This just sends an empty subject in the email.
Can you offer some advice?
These worked ok
"Dynamic From" email_add
"Dynamic To Email" email_add
but not these...?
"Dynamic Fromname" title f_name l_name
"Dynamic Subject" title l_name has submitted an inquiry!
"Dynamic From" and "Dynamic To Email" worked but when I try with "Dynamic Fromname" or "Dynamic Subject" I just get empty fields in the email I receive.
title - Mr., Ms., etc
f_name - first name
l_name - last name
Any advice?
Relevant Form Code:
<tr>
<td bgcolor="#D4D0C8"><label class="cf_label">Title *</label> </td>
<td bgcolor="#D4D0C8"><select class="cf_inputbox validate-selection" id="title" size="1" name="title"><option value="Select One">Select One</option><option value=" Mr."> Mr.</option><option value="Mrs.">Mrs.</option><option value="Ms.">Ms.</option></select><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" height="16" width="16"></a><div class="tooltipdiv">Title * :: Please select your title.</div> </td>
<tr>
<td bgcolor="#D4D0C8"><label class="cf_label">First Name *</label> </td>
<td bgcolor="#D4D0C8"><input class="cf_inputbox required" maxlength="150" size="30" id="f_name" name="f_name" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" height="16" width="16"></a><div class="tooltipdiv">First Name * :: Enter your first name. Also know as a given name.</div> </td>
<tr>
<td bgcolor="#D4D0C8"><label class="cf_label">Last Name *</label> </td>
<td bgcolor="#D4D0C8"><input class="cf_inputbox required" maxlength="150" size="30" id="l_name" name="l_name" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" height="16" width="16"></a><div class="tooltipdiv">First Name * :: Enter your last name. Also know as a family name.</div> </td>
</tr>
You can only put one field name in the Dynamic Subject and Dynamic From Name boxes. They don't allow you to have anything else.
If you want to build a string like this than you need to do that in the OnSubmit Before code and set the field value as we did before.
<?php
$title = JRequest::getString('title', '', 'post');
$f_name = JRequest::getString('f_name', '', 'post');
$l_name = JRequest::getString('l_name', '', 'post');
$d_fname = "$title $f_name $l_name";
JRequest::setVar('d_fname', $d_fname, 'post');
?>
Then put d_fname in the Dynamic FromName boxBob
Much later: edited to add missing 's after 'post
Code:
<?php
global $row_jos_chronoforms_tablename;
echo $row_jos_chronoforms_tablename->cf_id;
?>
My config:
Joomla 1.5.9
ChronoForms V3.1 RC2
Auto generated code: Before E-Mail
Order of Autogenerated block:2
Order of OnSubmit block:3
Order of Plugins block:1
That's correct, use the switch on the Autogenerated tab to have the Database save execute before the emails are sent.
Bob
Auto generated code: Before E-Mail
<?php
global $row_jos_chronoforms_tablename;
echo $row_jos_chronoforms_tablename->cf_id;
?>
this should be in the "email template" WITHOUT editor if you want to show it in the email body, but as a subject its different, tell me where you want it exactly!
Cheers
Max
$emails[0]->subject=$row_jos_chronoforms_Order->cf_id;
in "On Submit - before sending email" code, but "$row_jos_chronoforms_Order->cf_id" isn't empty only in "On Submit - after sending email" and in E-Mail template, and I need to put cf_id to the Subject.
==============================
P.S. Sorry for my english :?
you must add
global $row_jos_chronoforms_tablename;
before you use this variable, in the same box, are you doing that ?did you try the 2 lines above in the onsubmit after email ? what was the result ?
cheers
Max
Hi,
you must add
Code: Select all
global $row_jos_chronoforms_tablename;
before you use this variable, in the same box, are you doing that ?
Yes, of course.
did you try the 2 lines above in the onsubmit after email ? what was the result ?
Yes, this code work perfect in the onsubmit after email and in the email template.
This variable ($row_jos_chronoforms_Order->cf_id;) work everywhere (On submit after email, In e-mail body and in the chronocontact.php->$subject), but not in "On submit before...", array $row_jos_chronoforms_tablename is empty at this step.
Cheers
Max
Here is my settings:
[attachment=2]agc.jpg[/attachment]
[attachment=1]run_order.JPG[/attachment]
[attachment=0]code.JPG[/attachment]
Regards
Max
Find:
if($before_email_code){
CFDoRunCode('onsubmitcodeb4', '', $paramsvalues, $debug, $cf_row, $posted);
CFDoRunCode('autogenerated', 'before_email', $paramsvalues, $debug, $cf_row, $posted);
}
Replace:
if($before_email_code){
CFDoRunCode('autogenerated', 'before_email', $paramsvalues, $debug, $cf_row, $posted);
CFDoRunCode('onsubmitcodeb4', '', $paramsvalues, $debug, $cf_row, $posted);
}
I just replace strings. But i still can't use $emails[0], code like
echo $emails[0]->subject;
didn't work, maybe it's my fault;
Regards
Max
I am new to chronoform. I saw some postings regarding sending email
incuding cf_id. I have Joomla 1.5.15 + Chrnonform v3.1.RC5.5. No matter how
I did, I still couldn't get it to work.
I have set up:
1. Saving Data/Emails order: Before Email
2. Set e-mail template "use email editor" to NO
3. Add the following code to the email templates and the step 4 "After Form
Submission"
<?php
global $row_jos_chronoforms_TX06Registration;
echo $row_jos_chronoforms_TX06Registration->cf_id;
?>
4. RunOrder set to Autogenerated block (2), OnSubmit blick (3), Plugins
block (1)
Neither of them gave me the result I need. I could not get cf_id out of the
database. Could you help me out?
Here is my autogenerated code:
<?php
$MyForm =& CFChronoForm::getInstance("TX06Registration");
if($MyForm->formparams("dbconnection") == "Yes"){
$user = JFactory::getUser();
$row =& JTable::getInstance("chronoforms_TX06Registration", "Table");
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );
if (!$row->bind( $post )) {
JError::raiseWarning(100, $row->getError());
}
if (!$row->store()) {
JError::raiseWarning(100, $row->getError());
}
$MyForm->tablerow["jos_chronoforms_TX06Registration"] = $row;
}
?>
This code looks very strange
<?php
global $row_jos_chronoforms_TX06Registration;
echo $row_jos_chronoforms_TX06Registration->cf_id;
?>
If you look near the end of the Autogenerated code you will get a clue about what it should be. Please try this version:<?php
$data =& $MyForm->tablerow["jos_chronoforms_TX06Registration"] ;
echo $data->cf_id;
?>
Bob
Thanks for quick response. Below is my e-mail template. However, I still
didn't get the cf_id in the email. I'm sorry. I'm not familiar with script.
I even removed autogenerated code just to allow the system to regenerate.
it still didn't work. Do you have any idea what went wrong?
<?php
$data =& $MyForm->tablerow["jos_chronoforms_TX06Registration"] ;
echo $data->cf_id;
?>
<strong>2010 CSX Beginning and Intermediate Class (TX06) Online
Registration Form</strong>
<br />
<strong>First Name</strong>
<br />
{first_name}<br />
<strong>Last Name</strong>
<br />
{last_name}<br />
<strong>中文名 / Other Name</strong>
<br />
{middle_name}<br />
<strong>Gender</strong>
<br />
{gender}<br />
<strong>Street Address</strong>
<br />
{street_address}<br />
<strong>Supplemental Address 1</strong>
<br />
{supplemental_address_1}<br />
<strong>Supplemental Address 2</strong>
<br />
{supplemental_address_2}<br />
<strong>City</strong>
<br />
{city}<br />
<strong>State</strong>
<br />
{state}<br />
<strong>Postal Code</strong>
<br />
{postal_code}<br />
<strong>Phone (Number only i.e. 7136668888)</strong>
<br />
{phone}<br />
<strong>E-mail</strong>
<br />
{email}<br />
<strong>How did you hear about this class?</strong>
<br />
{radio0}<br />
<strong>Have you attend this class before?</strong>
<br />
{radio1}<br />
<strong>If yes, what is your previous student ID?</strong>
<br />
{old_id}<br />
<strong>Translation Needed?</strong>
<br />
{radio2}<br />
You need some familiarty with script - or to find someone who has to help you. This is not particularly difficult but it's not trivial either.
The PHP 'echo' outputs the value which is useful for debugging but not what you need here.
I'm sorry, I am very busy at the moment and don't have time to write the code for you.
Bob
Hi kh28102000,
You need some familiarty with script - or to find someone who has to help you. This is not particularly difficult but it's not trivial either.
The PHP 'echo' outputs the value which is useful for debugging but not what you need here.
I'm sorry, I am very busy at the moment and don't have time to write the code for you.
Bob
Hi Bob,
The code you gave me did fix the problem. Now I'm able to get some data out of the table.
Thank you very much for your help.
i've created a simple form with Chronoforms component, i have the e-mail column at {text_3}
what should i do to send who fills the form a simple e-mail answer automaticly with a standart thank you text with 4 or 5 lines like that :
Спасибо! Ваше сообщение успешно доставлено. Пожалуйста ожидайте ответа. Наши инженеры с Вами обязательно свяжутся.
-
Thank you! Your form has been delivered. Please wait for an answer. Our engineers will contact you as soon as possible.
MY COMPANY NAME
sorry for my bad English.. but i think a clear answer will be helpfull for me.
Create an Email Setup with a Dynamic To element instead of a To element and put text_3 (with not quotes or brackets into the box.
Edit the Email Template to include your message.
Bob
thats clear but where should i write that message:
Спасибо! Ваше сообщение успешно доставлено. Пожалуйста ожидайте ответа. Наши инженеры с Вами обязательно свяжутся.
-
Thank you! Your message has been delivered. Please wait for an answer. Our engineers will contact you soon.
MY COMPANY NAME
THANKS for help GREY.
Hi. This is the qmail-send program at srv55.turhost.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
<volkan@msn.com>:
Connected to 65.55.37.104 but sender was rejected.
Remote host said: 550 OU-001 Unfortunately, messages from 94.199.200.155 weren't sent. Please contact your Internet service provider since part of their network is on our block list. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
--- Below this line is a copy of the message.
Return-Path: <info@oll.ru>
Received: (qmail 1441 invoked by uid 10062); 10 Jan 2011 19:30:12 +0200
To: [email]volkan@msn.com[/email]
Subject: =?utf-8?B?0J7QvdC70LDQudC9INCX0LDQutCw0Lc=?=
X-PHP-Script: oll.ru/index.php for 178.177.89.211
Date: Mon, 10 Jan 2011 19:30:12 +0200
From: OLL <info@oll.ru>
Message-ID: <a62e25829a9eb0e2e6a1eb40b7961645@oll.ru>
X-Priority: 3
X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.4]
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/html; charset="utf-8"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base href="http://oll.ru//" />
<title>Email</title>
</head>
<body><p>СпаÑибо! Ваше Ñообщение уÑпешно доÑтавлено. ПожалуйÑта ожидайте ответа. Ğаши инженеры Ñ Ğ’Ğ°Ğ¼Ğ¸ обÑзательно ÑвÑжутÑÑ.<br /><br />-<br /><br />Thank you! Your message has been delivered. Please wait for an answer. Our engineers will contact you soon.<br /><br /><br />OLL</p><br /><br />
Submitted by 168.177.89.221</body>
</html>
That's MSN blocking emails from your site. ChronoForms is sending it OK.
Please contact your Internet service provider since part of their network is on our block list.
Bob