1

I am building a site that lists different service providers.

On each service provider's page there is a contact form (the same form for each service provider).

The email address of each service provider (the recipient) is in the channel entry.

How can I get the email sent to each respective service provider - as well as the site owner?

I am trying to avoid using a different script for each form - and I don't want to expose the recipient's email address in the page code.

2 Answers 2

1

If you look at the Template Parsing order, you will see that segment variables are parsed before Preload Replace Variables. You can take advantage of that.

{if segment_2 == "foo"}
    {preload_replace:pr-recipient="[email protected],"}
{if:elseif segment_2 == "bar"}
    {preload_replace:pr-recipient="[email protected],"}
{/if}

    {preload_replace:pr-recipient=""}

{exp:email:contact_form user_recipients="no" recipients="{pr-recipient}[email protected]" charset="utf-8"}

    [...]

{/exp:email:contact_form}
1

I'm not exactly sure how the above answer would have worked, I'm really not sure I understood it. :/

However, I was able to accomplish what I wanted pretty easily with Solspace's Freeform. Also I needed custom fields which Freeform is great at doing.

Also I need to mention Solspace has awesome support.

Your Answer

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

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