A Notification object stores information about your email notification. Each notification belongs to a single form, but a form can have many notifications. Whenever you're dealing with a notification in your template, you're actually working with a Notification object.

Attributes #

idID of the notification.
formIdThe Form ID this notification belongs to.
templateIdThe Email Template used by this notification.
nameThe control panel name for this notification.
enabledWhether the notification is enabled.
subjectThe subject for the email.
toThe email address(es) the notification will be sent to.
ccThe email address(es) the notification will be cc-ed to.
bccThe email address(es) the notification will be bcc-ed to.
replyToThe reply-to email for the notification.
replyToNameThe reply-to name for the notification.
fromThe email address of the sender for the email notification.
fromNameThe name of the sender for the email notification.
contentThe raw JSON-based block content for the email. See also Content.
attachFilesWhether to attach user-uploaded files to the notification.

Methods #

getParsedContent()Returns the rendered HTML as generated by the rich text editor in the control panel.

Content #

We use TipTap - a Vue-based rich text field to allow users to add content to their email notification. This in turn, uses ProseMirror. ProseMirror stores all HTML content as JSON-blocks of content, rather than the raw, generated HTML.

As such, when you want to get the HTML for an email notification, you should use getParsedContent(), but you can also use content to get the raw array of content blocks, if you want fine-grained control about how to output the DOM nodes. We would highly recommend the following packages (with Formie uses) to parse and handle this content:

Variable Content #

In addition, we also use a cut-down version of TipTap for a number of fields in a notification, namely the email fields. This allows easy picking of emails, both from the system and email fields, without having to worry about Twig syntax, field handles, or anything client-unfriendly.

These variables are stored in shorthand Twig format, and are parsed before they are used. For example, you might have an emailAddress field in your form, and you want to use in the to address. You can either pick this variable from the variable dropdown field in the control panel, or you can write {emailAddress} which is the equivalent. In fact, this is how the content is stored.

If you wanted to show this content in the email, directly outputting the to attribute would render {emailAddress} - probably not what you want. Instead, you can wrap this content in the variable-parsing function Formie itself uses.

{% set toEmail = craft.formie.getParsedValue(, submission) %}
$toEmail = \verbb\formie\helpers\Variables::getParsedValue($notification->to, $submission);

For the above, it's a requirement to provide both the string that you want to parse, and the submission, which contains the object of content to get values from.

Get started with Formie

Available for Craft 3. Get it from the plugin store.