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

Replying to e-mails

Sending an e-mail to the site administrator is great, until he decides to reply. Then we have a problem. When you click Reply, the e-mail that opens is addressed to the site administrator (actually, we set it to info@example.com if you recall). So, he sends the e-mail to himself, and not to the person who submitted the form.

Yet their e-mail is right there in the e-mail text. Can't we put that in the From Email field? Then the reply will go just where we want it.

Well, yes we could put the e-mail in there (technically using a Dynamic From Email field). But then we find that the administrator no longer receives any e-mails at all!

This is most likely because the site ISP is checking for spammers and one of the checks that they run is to compare the site domain with the domain in the From Email header of the e-mail. If they don't match, the e-mail is marked as "likely spam" and dropped in the bin.

The answer is to use the Reply To Name and Reply To Email headers.

Getting ready

We're going to use the form from the end of Chapter 1, Creating a Simple Form which has Name and Email fields.

How to do it...

In Chapter 1, Creating a Simple Form, we used Wizard Edit to change our form; here we're going to start exploring the complexity of the Form Editor. Fortunately, in this case it is pretty much the same.

  1. In the Forms Manager click the Form Name to open the Form Editor.
    How to do it...

    When the Form Editor opens, notice that there is a row of tabs starting with General, next to which is Setup Emails. This is the one that we want, so click the tab to open it.

    How to do it...

    As expected, what is on this tab is pretty much identical to the Email Setup view from the Wizard Edit and what's more, there is all the data we entered in the Wizard Edit.

  2. There, we already have the four elements that are required to enable an Email Setup. We are now going to add two more "Reply To" elements for the information that the user has submitted in the form.

    We need their name and their e-mail address and we already have these fields in our form; so far so good. But we can't just type the values in because they are going to be different each time the form is submitted.

    We call these changing values dynamic as opposed to the static unchanging values we have so far.

    And you'll notice that in the Toolbox there are two versions of each element — To and Dynamic To, Subject and Dynamic Subject, and so on.

    To capture values input from the form, we use the dynamic versions. And instead of static values we put field names into the boxes. Then when the form is submitted, ChronoForms will put in the values from the submitted form.

    First drag the Dynamic ReplyTo Name and the Dynamic ReplyTo Email elements into the workspace.

    How to do it...
  3. Now we just need to add in the field names for those two fields in the two boxes. They were text_0 for the Subscriber Email input and text_1 for the Subscriber Name input.

    Note

    Important note: We enter just the field names in the boxes with no quotes, no brackets, and no spaces.

    How to do it...
  4. That's all we need for now, so let's save the Form using the Save icon in the Form Editor toolbar and return to the Forms Manager.
  5. Click the Form link again to open the form; put some information into the boxes and submit the form.

    When the e-mail arrives click the Reply To button and you should find that the To... address for the e-mail is set to the address of the new subscriber.

    How to do it...

    Note

    The way that e-mail headers are handled differs a little between ISPs who send the e-mails and the mail readers that we use to read and reply to them. You may not see exactly the same result.

See also

  • Chapter 1, Creating a Simple Form. The Send your form results by e-mail section describes how to use the Form Wizard to set up e-mails, and the Format your e-mail section talks about formatting the content of the e-mail.