1

I have created a rule for sending an email after a new user registered. I would like to add a Rules Condition to send the email to the target based on the selection in the registration form.

For example: if I select the country as india I need to send to india@gmail.com and for other others@gmail.com.

I have tried adding a condition in To mail receipt address:

$email = ($account->country == 'india'? india@gmail.com : 'other@gmail.com')
echo $email;

Can you suggest how to handle the scenario?

| improve this question | | | | |
1

You should be able to get this to work by creating a single rule using the Conditional Rules module (and Rules of course). The rule should be trigger by Rules Event "after saving a new user account".

For some samples to put together such rule (in Rules export format), refer to my answer to either of these questions:

The actual Rules Action you want to use, should be pretty similar to the Rules Action included in my answer to "How to send an email via a Rules action using a field key?".

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.