1

I'm trying to have a Freeform Pro on my site that not only emails the site owner when it's submitted but an external email contact as well.

The external email is a field from a channel called company. I was hoping something like this could work:

{exp:channel:entries channel="companies" limit="1" site="default_site"}    
{exp:freeform:form form_name="el_list_form" required="name|email|phone|company" return="/search" recipient1="{company_email}"}
...
{/exp:freeform:form}
{/exp:channel:entries}

At the moment it emails the admin_notify in the freeform settings just fine but will not email the company_email contact. I tried just sticking in my own email manually and it doesn't seem to like that either.

I tried to see if it was my mail in general that was the issue by sending out a site communication message but that sent just fine.

Any ideas?

2 Answers 2

1

This looks like a parsing order issue.

By default the Template Engine will start to parse by innermost module variable. So, in your case, exp:freeform:form is parsed before exp:channel:entries.

You need to make the exp:channel:entries be parsed first to make the {company_email} available to exp:freeform:form. For this, set the value of its parse parameter to inward:

{exp:channel:entries channel="companies" limit="1" site="default_site" parse="inward"}
  {exp:freeform:form form_name="el_list_form" required="name|email|phone|company" return="/search" recipient1="{company_email}"}
    [...]
  {/exp:freeform:form}
{/exp:channel:entries}

It's just this.

1

If you aren't using different notification templates for each recipient then you can use a pipe delimited list of email addresses for the admin_notify parameter (or specify them in the form tag parameters)

If you still encounter a parse order problem you might want to try adding a freeform field for the second address and including a hidden field in the form into which you put the second email address.

Then you could try using the name of that hidden field in your form tag.

Something like

<input type="hidden" name="second_email" value="{company_email}">

Then in your form tag pair use

{exp:freeform:form form_name="el_list_form" required="name|email|phone|company" return="/search" recipient1="{second_email}"}

Not tried it but it might work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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