Setting up an Auto Responder to email the sender

An auto responder allows you to set up an email that is returned to the user that filled out your form. By default the auto responder message is similar to the following.

<p>Thank you for your submission. A copy of the information you sent is shown below.</p>
{{tableContent}}

Take note of the special string tag "{{tableContent}}" in this output. This special tag will be replaced with the same table of content that is normally sent to the receiver of the form submission. In some cases you may not want to send this information back to the user, however you can fully customize the content of the auto responder email by using the setAutoResponderEmailContent method on the FormItBuilder object.

To use the auto responder simply add a few lines to your form snippet like so

//Firstly add the FormItAutoResponder into your array of hooks
$o_form->setHooks(array('spam','email','FormItAutoResponder','redirect'));

//Set email addresses and format
$o_form->setAutoResponderToAddressField('email_address'); //this must be the field ID for your return email, NOT the email address itself
$o_form->setAutoResponderFromAddress('from@mybusiness.address');
$o_form->setAutoResponderFromName('Business Title');
$o_form->setAutoResponderHtml(true); //You can use a plain text email if you wish, just set this to false
$o_form->setAutoResponderReplyTo('reply@mybusiness.address');

//Set the email content
$o_form->setAutoResponderSubject('Thanks for sending us your query');
$o_form->setAutoResponderEmailContent('<p>Thanks. Your information listed below</p>{{tableContent}}<p>has been received.</p>');

//In most cases these probably will not be used, but you can also send the responder to a CC and BCC address.
$o_form->setAutoResponderCC('cc@to.another.address');
$o_form->setAutoResponderCCName('Business Title');
$o_form->setAutoResponderBCC('bcc@to.another.address');
$o_form->setAutoResponderBCCName('Business Title');

Forms prior to the release of 1.3.0pl

Please Note: The main snippet call for forms was updated after the release of version 1.3.0pl. The autoresponder systems require the new snippet footer IF block as shown below. You must ensure you update old snippets with this code for the auto responder system to work. See the Basic Example for a complete example of a snippet.

//Run the form construction function above
$o_form = FormItBuilder_BasicExample($modx, $snippetName);
if (isset($outputType) === false) {
    //this same snippet was called via various other hooks
    return $o_form->processCoreHook($hook, $o_form);
} else {
    //Final output for form
    return $o_form->output();
}