Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
{% register_form_confirmation_field "person_email", template: "default_email" %}=

This will register the field "person_email" as a confirmation_field. When someone fills in the form, and inputs someone@getplate.com in the field person_email, then an email will be sent to someone@getplate.com with the content found in the theme file located at "/mails/default_email.plate".

...

Code Block
Dear {{ submitted_form_fields["Name"] }}
<br> 
Thank you very much for your message on {{ site.name }}. We will get back to you within the hour.
<br>
<br>
Kind regards
<br>
The Plate-Team

Custom Admin Confirmation Mail

You can also use the register_form_confirmation_field tag to send a custom mail to an Admin. In this case, you specify the email address to which a confirmation mail is sent directly with the 'to' argument. This argument is used instead of a confirmation_field in which the email will be provided by the site visitor.

For readability you can use register_form_confirmation. It has the same function as register_form_confirmation_field.

Accepts the following arguments:

  • body: the content for the confirmation email.

  • template: the template for the confirmation email.

  • subject: the subject for the confirmation email. (Required)

  • to: the receiver for the admin confirmation mail. (Required)

Note: In the form tag, to: contact_form.email has to be included as fallback.

Note: Only 1 of the arguments ‘body’ and ‘template’ is allowed at the same time. 

Note: A subject is required. The subject accepts liquid.

Note: If the ‘to’ argument in both the form and register_form_confirmation_field are given, the ‘to’ argument in form will be overwritten.

Note: The ‘body’ does not accept liquid as an argument.

Note: Does not accept a ‘field_name’ value as first argument.

Example 1

Code Block
{% register_form_confirmation_field subject: "This is the email subject",
body: "This is the email body", to: "example@email.com" %}

This will register the argument given for ‘to’ as the email address to which the confirmation mail will be sent. This contains “This is the email subject” as subject and “This is the email body" as the email body.

Example 2

Code Block
{% assign subject = "Confirmation subject {{ submitted_form_fields['name'] }}"  %}
{% register_form_confirmation_field 
  subject: subject,
  body: "This is the email body", 
  to: "example@email.com" 
%}

This will render the “name” field, as part of the submitted_form_fields, in the subject line.

The objects that are accessible are the same as for the regular register_form_confirmation_field:

  • submitted_form_fields similar to the object in that is accessible in the form tag. This allows you to render the submitted fields in the confirmation email.

  • site The same as the site objects inside the Plate templating language

  • form The element that represents the form, so the object used in the for attribute of the form tag.