Forums

Send email according to option select

Kheema 26 Mar, 2012
Hi,

I've a requirement In my contact form; there will be a drop down list and on the basis of selected option an email will go to a different persons.

For example if user select option1 from the drop down list the mail goes to 1st person mail account, if user select select option2 and option3 all the form details goes to any third person email account.

I am using Joomla 1.5.15 and chronoform 3.0 STABLE

Can anyone help me how to implement this functionality in the form ?

Regards,
Kheema
GreyHead 26 Mar, 2012
Hi Kheema,

Please see FAQ #31 from the FaQs menu above.

Bob

PS You have very old versions of Joomla and ChronoForms.
Kheema 27 Mar, 2012
Hi Bob,
Thanks you for guiding me, since my site is very old that's why both version are too old..

I tried to switch on chronoform version 4.0 but I found it really hard..

I wish there could be some video tutorials.

Regards,
Kheema
GreyHead 27 Mar, 2012
Hi kheema,

There are a series of videos here that will help you get started with CFv4.

Bob
Kheema 27 Mar, 2012
Hi Bob,

The solution you provided to me doesn't solve my problem. I think I need to write in details what actually I need.

I've a contact form and there is a list view option. and if User choose any options; A respective person will get an automatic email with the full user details filled up by User.

For example if user select option1 the Person A will get all the info with the selected option.
and if User select option2 or3 the Person B will get full user details including the options he selected.

I hope I write a clearly now what actually I am looking.. I checked the faq and put the code but that doesn't work.

If you need any information, please let me know

Thanks & Regards,
Kheema
Kheema 29 Mar, 2012
Hi Bob,

How are you? I am still waiting for your feedback.

Regards,
Khemea
GreyHead 29 Mar, 2012
Hi Kheema,

The code in the FAQ works for ChronoForms v3 as far as I am aware.

If you have some problems with it then please post your code here and turn debug on in the form General Tab, then submit the form and post the debug - including the 'dummy emails' results here.

Bob
quantum_leap 20 Jun, 2012
Hello, I would like to do a similar thing and I am using version 3. Could you please tell me which exact tutorial is it? FAQ no 31 is titled "My form won't save" and that's not the right tutorial.
GreyHead 20 Jun, 2012
Hi quantum_leap,

Hmmm you're about ten days too late. Max just took down all the old FAQs when he put up the new CC+CF FAQ application.

But it's still in the database :-)

One ChronoForms user wanted to offer form users a drop-down list of e-mail addresses that they could pick from and send the form results to - but they wanted to do it without putting the email addresses themselves on the form page.

We found a way to do this in two parts. First include the following in your Form HTML:

Select the recipient you wish to contact:
<select name="recipients"><
	<option value="em1">Name 1</option>
	<option value="em2">Name 2</option>
	<option value="em3">Name 3</option>
	. . . 
</select>


Then enter this code in the 'On Submit code - before sending email' field:

For ChronoForms 3.1 and later:
<?php
$emails_2 = array(
	'em1'=>'sample1@email.com', 
	'em2'=>'sample2@email.com', 
	'em3'=>'name_3@example.com', 
	. . .
);
$MyForm =& CFChronoForm::getInstance('form_name_here');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$MyFormEmails->setEmailData(1, 'to', $emails_2[$_POST['recipients']]);
?> 


For ChronoForms v3.0 and later:
<?php
$emails_2 = array('em1'=>'sample1@email.com', 'em2'=>'sample2@email.com', 'em3'=>'name_3@example.com', . . .);
$emails[0]->to .= ','.$emails_2[$_POST['recipients']];
?>


For ChronoForms 2.5.x and earlier
<?php
$emails = array('em1'=>'name_1@example.com', 'em2'=>'name_2@example.com', 'em3'=>'name_3@example.com', . . .);
$rows[0]->extraemail = $emails[$_POST['recipients']];
?>


Thanks to deafjoomla.com for this FAQ



Bob
quantum_leap 21 Jun, 2012
Thanks for that. My situation slightly differs though. Basically I want to deactivate an email that I 've setup only if a certain selection from a dropdown menu has been selected. I want to prevent sending a message to an email I've set up if a certain dropdown option has been selected. Is that possible?
quantum_leap 21 Jun, 2012
Basically I want to have access to the third email set up so I can disable it when a certain value from a dropdwon box is selected. I could write an if statement in the submit before sending email box but I don't know how to have access to the third email setup. Cheers.
quantum_leap 21 Jun, 2012
Found it!

if ($_POST['payment_method'] != "Credit Card") {
    $MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
    $MyFormEmails->setEmailData(3, 'enabled', false);
  }


It disables the third setup email.
GreyHead 22 Jun, 2012
Hi quantum_leap,

Well found. I was away yesterday and hadn't got round to searching for it this morning.

Bob
This topic is locked and no more replies can be posted.