ChronoForms 3.1 for Joomla! site Cookbook
上QQ阅读APP看书,第一时间看更新

Sending a "Thank you" e-mail to the form submitter

We've already sent e-mails to the administrator with the form information in it. Sometimes you also want to thank the form submitter too. These e-mails seem to fall into two broad groups — confirming the details on the submitted form, and simpler messages that say "thanks" with maybe a little extra info.

ChronoForms will do either (or a combination) quite happily. Here you are going to see how to create an e-mail from the second group.

How to do it...

  1. We'll use the same form again. Go into the ChronoForms Form Manager, open up newsletter_signup in the Form Editor, and go to the Setup Emails tab. Now click the envelope icon to create a new e-mail setup.
    How to do it...
  2. A new pink workspace opens up at the bottom of the screen. This works in the same way as the first one. We can drag elements on there and ChronoForms will "fill in the blanks" when the form is submitted, and send a second e-mail.

    Tip

    You can keep on adding e-mail setups here though it's pretty unlikely in practice that you'll need more than two or three.

    As we want to send an e-mail to the form user we need a Dynamic To element plus Subject, From Name, and From Email; all non-dynamic versions. We don't need to use ReplyTo fields because this time the e-mail will be from us and the From Email will work correctly if the user clicks Reply.

  3. Enter the name of the e-mail input from the form into the Dynamic To element. Then add entries in the other inputs as we did in the earlier recipe.
    How to do it...
  4. We'll set Record IP to No here as there is little purpose in sending the user's IP address back to them.

    And before finishing we need to enable the Email Setup.

  5. Then complete the Email Setup by clicking Apply in the Email Properties tab to save your changes.
  6. Now we need to switch to the Email Templates tab to create the message that we want to send.
    How to do it...

    Note that ChronoForms has automatically created a second e-mail template for us to work with.

    Tip

    Although neither e-mail setups nor templates are obviously named, they are related by the order in which they appear. The first Email Template links to the first Email Setup, and so on.

    We can use the {field_name} syntax in here so let's add a quick thank you note:

    Dear {text_1},
    Thank you for subscribing to our newsletter, we hope that you enjoy all of the future editions.
    Regards The example.com team
    
  7. Save the form to save both the Email Setup and Email Template, then test the form to make sure that both e-mails are sent.