Twig Templates Forms Support
Use data from Mautic form submissions in your Twig templates.
You can use data that contacts submit through Mautic forms directly in your emails or landing pages using Twig Templates.
Important: This only works if the email is sent using:
- A “Send email to contact” action directly on a form.
- A “Send email” action in a campaign that starts when a form is submitted.
Form Data Tokens
When an email is sent in one of the ways mentioned above, you can use these special tokens:
{{ formresult }}
: Contains the data from the single, most recent form submission by the contact.{{ formresults }}
: Contains a list (array) of all form submissions made by the contact.
Using the Last Submission (formresult
)
To show data from the contact’s latest form submission, use the formresult
token. You access the submitted values using the form field’s alias (the unique name you gave the field).
Using All Submissions (formresults
)
If you need to show data from older submissions, you can loop through the formresults
list. Each item in the list (result
in the example below) works like the formresult
token.
This lets you show past interactions or use historical form data in your content.