Buy Now
Sign in

How to set contact form to choose recipient?

Cikiriki , November 16 2017, 11:42
Cikiriki 1
November 16 2017, 11:42 #373572

I'm trying to set up contact form where you choose one of the recipients and I want that only chosen recipient gets email. My problem is that I used options that I found on these forums however even when one of recipients is chosen every recipients gets email in the end.

I have CF5 installed on my joomla 2.5 site and I'm using demo-basic-contact-captcha form where I added radio buttons with recipients to choose, in these buttons I have set values in 'option' section :

Then I have placed costume code in 'setup' tab with next code:

// set a default recipient
$recipient = 'em1';
if ( isset($form->data['recipients']) && $form->data['recipients'] ) {
$recipient = $form->data['recipients'];
$emails = array (
'em1' => '',
'em2' => '',
'em3' => '',
'em4' => '');
$form->data['email_to_use'] = $emails[$recipient];

Then I put Email event with email_to_use action lable.
In it, on 'To' section I placed emails separated with comma.

What did I do wrong? I want that only chosen recipient gets email and not all of them after sending a a message.


GreyHead 65
November 17 2017, 13:37 #373594
Hi Cikiriki,

Please check the FAQ - you need to add email_to_use in the Dynamic To box of the Email action.

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much