Problem with sending mail to specific recipients

How to send emails to different addresses based on a form selection in ChronoForms.

Overview

The issue occurred because the dynamic recipient field in the email action was incorrectly formatted with curly braces.
Ensure the Custom Code action runs before the Email action and enter the field name without braces in the 'dynamic to' field. To send different email bodies, use separate Email actions for each recipient.

Answered
mt mt-dev 20 Feb, 2015
Hi,

I'm facing a problem with sending mail depending of a select box, which name is {theme}.
I tried the code explained in this page ;
http://www.chronoengine.com/faqs/52-cfv4/cfv4-emails/2603-how-can-i-send-an-email-to-different-addresses.html

But it's not sending the mail to the desired mail address, I tried to debug and here that's what I get in the 'Data array' :

Array
(
    [option] => com_chronoforms5
    [chronoform] => contact_part
    [event] => submit
    [N_nom] => Untel
    [prenom] => Toto
    [email] => aa@sd.com
    [telephone] => 
    [ncompte] => 
    [theme] => com
    [Nquestion] => Test question
    [dropdown17] => francais
    [dropdown21] => mail
    [captcha] => 
    [button18] => Envoyer
    [email_to_use] => desired.mail@example.com
)

And in the 'Debug Info' I have that answer :

Array
(
    [9] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:, other.mail@mydomain.com  //the default one in the mail settings
                    [2] => Subject:Demande de contact 
                    [3] => From name:Contact
                    [4] => From email:contact@mydomain.com
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Body:
[...]


Did I miss something somewhere ?
Can you help me troubleshooting this problem ?

Thanks in advance
Gr GreyHead 20 Feb, 2015
Hi mt-dev,

Do you have the Custom Code action *before* the Email action?

Bob
mt mt-dev 20 Feb, 2015
Hi Bob,

I fixed my problem meanwhile !
I made a small mistake inside the "dynamic to" field, I put the field name between {}.
You can close this topic.

Thanks for your support and patience.

Bye
mt mt-dev 20 Feb, 2015
Before closing the topic, I would like to know if there is a way to send different "Body" to different addresses with one submit.

Do you have a clue about that ?
Gr GreyHead 20 Feb, 2015
Answer
Hi mt-dev,

Yes, but I think you'd need to use a new Email action for each body.

Bob
mt mt-dev 20 Feb, 2015
Perfect !

Works like a charm, thanks for your help !!

You can definitvely close the topic
This topic is locked and no more replies can be posted.