1

I have a situation where I need a form to submit and be sent to my company's email address AND to an email address outputted from an email field from the entry that the form sits on. Is it possible to have a hidden input in the template that contains the email addresses I want the notification to go to?

1 Answer 1

2

I've figured this out (the solution is not in the docs). Follow these steps:

1) In the amforms plugin's settings, create a custom text field called 'notificationRecipients'.

2) Add that field to your form's list of fields in the form's settings.

3) Under the notifications tab of your form, add this to your "Email Recipients" field:

defaultAddress@domain.com,{notificationRecipients}

4) Now in your template, add a hidden input in the <form> like so:

<input type="hidden" name="fields[notificationRecipients]" value="{{ entry.yourCustomFieldEmailAddress }}">

Keep in mind that multiple emails should be separated by commas like example1@gmail.com,example2@gmail.com,example3@gmail.com


That's it!

If you don't want the list of email recipients to appear in your notification email, then you need to edit line 24 of craft/plugins/amforms/templates/_display/templates/email.twig to look like this:

{% for field in fields if field.getField().handle != 'notificationRecipients' -%}

Additional examples and info can be found on these closed issues of the developer's git page:

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.