Contact Form Templates


Using Contact Form Templates

To use a custom email template simply add the following field to your form:

<input type="hidden" name="message[template]" value="{{ 'path/to/template'|hash }}">

The message[template] value is used to source the template file located in templates/_emails, this value must be hashed to avoid tampering.

Example

<input type="hidden" name="message[template]" value="{{ 'foo/bar'|hash }}">

Would look for the following template:

templates/_emails/foo/bar.twig

Template Variables

The submitted field values are available for use in your templates by using {{ submission }}

Example

<input type="text" name="fromName" value="Joe Bloggs">

Would be used in your templates using:

{{ submission.fromName ?? 'Fallback Value' }}

Which would output:

Joe Bloggs or Fallback Value

Free

Package Name

To install this plugin, search for its package name on the Plugin Store and click “Install”.


Information

  • Version 1.0.1
  • Last Update 4/11/2018
  • Active Installs 435
  • Compatibility Craft 3
  • License MIT
  • Categories Templating, Forms

Report an issue