2

Okay, so similar issue to this question (Sprout email notifications - setting the recipient?). I must be doing something stupid here because. Trying to set the recipient from an entry form, with a hidden field:

<input type="hidden" name="recipient" value="{{ 'name@address.co.uk'|hash }}">

Then in the control panel, the Recipients field has {recipient}. That should work right, but I don't receive the email. If I manually set an email address in the control panel Recipients field, it works fine.

  • Does it work if you don't hash the email? value="name@address.co.uk" – Simon Kuran Oct 29 '18 at 23:44
  • Hi Simon. Nope, hash or no hash makes no difference. – Ian Ebden Oct 30 '18 at 13:18
  • Are you using the Sprout Forms Hidden field? Or is this some other field type that you are hard coding in your Form Templates? Sprout Forms does support a default Email Dropdown field that would handle the obfuscation for you for pre-defined email addresses. You could add a hidden class to the field in the CP. – Ben Parizek Oct 30 '18 at 13:23
  • Hey Ben. It's just my own field. Doesn't need obfuscation really, since this is a members-only page. – Ian Ebden Oct 30 '18 at 13:28
1

This is possible with the Sprout Forms Invisible Field (be sure to update to the latest version). Using the Invisible Field will ensure your email address never shows up in the template. To set this up:

1) Add an Invisible Field (invisibleFieldHandle) to your form and set its value to {recipient}

2) Setup a Notification Email and set your Recipient field to the name of your Invisible Field Handle: {invisibleFieldHandle}

3) Before your Sprout Forms displayForm tag, set the value of the Email Address where you want to trigger the Notification Email:

{% do craft.sproutForms.addFieldVariables({ 
  recipient: 'email@website.com'
}) %}

{% craft.sproutForms.displayForm('contact') %}
| 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.