Auto-Responder
Auto-Responder
The Canvas form processor (include/form.php) can send an automatic confirmation email back to whoever submitted the form. You enable and configure it entirely with hidden fields in the form, no PHP editing required. Markup below is taken from forms-inline.html and forms-car-rental.html.
Structure
Add a set of hidden inputs to the form. Two are essential: replyto (which field holds the submitter's email) and autoresponder set to true.
<input type="hidden" name="prefix" value="template-inline-">
<input type="hidden" name="replyto" value="template-inline-email">
<input type="hidden" name="autoresponder" value="true">
<input type="hidden" name="ar_subject" value="Your Reservation has been confirmed!">
<input type="hidden" name="ar_title" value="Your Reservation">
<input type="hidden" name="ar_message" value="Dear {template-inline-name},<br><br>Your Reservation has been confirmed. See you at {template-inline-date-time}.<br><br>Thanks for your Reservation.">
<input type="hidden" name="ar_footer" value="Restaurant Name">Setup
The auto-responder only fires when both conditions are true: autoresponder is true and replyto resolves to a non-empty email address.
replytonames the form field that contains the visitor's email. In the example the visitor's email input istemplate-inline-email, soreplytois set to that field name. The processor reads the submitted value of that field and mails the confirmation there.autoresponder=trueturns the feature on. Any other value (or omitting it) disables it.
Message Placeholders
The ar_message supports {field-name} placeholders. The processor replaces each {...} with the submitted value of the field of that exact name. If the field was not submitted, the placeholder is removed.
<input type="hidden" name="ar_message" value="Dear {car-rental-name},<br><br>Your Car <strong>{car-rental-selected-car}</strong> Booking has been confirmed. Our Driver will pick you up on <strong>{car-rental-pickup-date}</strong> at <strong>{car-rental-pickup-address}</strong>.<br><br>Thank You.">Here {car-rental-name}, {car-rental-selected-car}, {car-rental-pickup-date}, and {car-rental-pickup-address} are replaced by the matching submitted field values. Use the field's full name (including the prefix) inside the braces. HTML tags such as <br> and <strong> are allowed in the message.
Full Example
<form class="mb-0" id="car-rental" name="car-rental" action="include/form.php" method="post">
<!-- visible fields: car-rental-name, car-rental-email, ... -->
<input type="hidden" name="prefix" value="car-rental-">
<input type="hidden" name="replyto" value="car-rental-email">
<input type="hidden" name="autoresponder" value="true">
<input type="hidden" name="subject" value="New Car Rental Request">
<input type="hidden" name="ar_title" value="Your Booking">
<input type="hidden" name="ar_message" value="Dear {car-rental-name},<br><br>Your Car <strong>{car-rental-selected-car}</strong> Booking has been confirmed. Our Driver will pick you up on <strong>{car-rental-pickup-date}</strong>.<br><br>Thank You.">
</form>Options
The hidden inputs the processor reads for the auto-responder:
autoresponder=trueto enable (default off).replyto= the field name holding the submitter's email address (required for the auto-responder to send).ar_subject= the confirmation email subject. Default:Thanks for your Email.ar_title= the heading shown at the top of the email body. Default:Its so good to hear from You!.ar_message= the body text, supports{field-name}placeholders and inline HTML. Default:Autoresponder Message.ar_footer= the footer line at the bottom of the email. Defaults to a copyright line with the current year.
Tips
- Set
replytoto the field name, not to an email address. The processor looks up that field's submitted value. - Placeholders must use the full field
name(with prefix), for example{template-inline-name}. - The auto-responder shares the same From address (
$fromemail) configured ininclude/form.php. Its own SMTP block is separate; see the PHP Settings doc. - If
replytopoints at an empty or missing field, no confirmation is sent even whenautoresponderistrue.
How to Use
- 1
Enabling the Auto-Responder
Enable AutoResponders easily for your Form Responses. Use the following settings inside the Form's HTML:
<input type="hidden" name="replyto" value="template-contactform-email"> <input type="hidden" name="autoresponder" value="true"> - 2
Customizing the Email
We have added more options to Customize the Auto-Responder Email Title, Subject and Body per Form. Simply use the Settings below:
<input type="hidden" name="ar_subject" value="Auto-Responder Email Subject"> <input type="hidden" name="ar_title" value="Thank You for your Email"> <input type="hidden" name="ar_message" value="We have received your Message and will get back to you shortly. Meanwhile, check our Website: http://www.website.com .<br><br>Thank You"> <input type="hidden" name="ar_footer" value="Copyright Company Name"> - 3
Auto-Responder Email Personlization
Easily Personalize your Auto-Responder Emails by adding the Form Field References enclosed within Curly Braces
{form-field}in your Auto-Responder Message:<input type="hidden" name="ar_message" value="Dear {template-contactform-name},<br><br>We have received your Message and will get back to you shortly. Meanwhile, check our Website: http://www.website.com .<br><br>Thank You"> <input type="hidden" name="ar_footer" value="Copyright Company Name">You can add as many Form Fields as you like in your Auto-Responder Message. Basic HTML is also supported.
- 4
Using SMTP for Auto-Responders
If you are using SMTP for sending Emails, chances are you will need to use SMTP for Auto-Responder too. Simply add the SMTP codes after the
$autoresponder = new PHPMailer();Line of Code and remember to replace$mail->with$autoresponder->.
