Customize the email subject line for form submission notifications

Have really sensitive email filters? Want to optimize form notifications for a particular recipient? You can now customize the email subject line for these notifications!

From the Netlify UI

Go to Site Settings > Forms > Form Notifications and edit or add a new email notification. You now have the option to set an email subject line:

You can use one of the following dynamic values in your subject line: %{formName} , %{siteName}, or %{submissionId}.

For example, you could set the subject line to:

New lead from %{formName} (%{submissionId})

From your markup

Netlify has historically supported subject line overrides from HTML, using an <input> with name="subject". However, overriding the subject line this way has not also overridden the [Netlify] subject line prefix.

For new forms

For forms created from this point on, the value of the <input> with name="subject" will fully override the email subject line, including the [Netlify] prefix. In this example:

<form name="contact" method="POST" data-netlify="true">
  <input type="hidden" name="subject" 
  value="Sales inquiry from mysitename.netlify.app" />
  <!-- Add other form fields here -->
</form>

The email subject line will be “Sales inquiry from mysitename.netlify.app”.

For existing forms

In our last example, notifications will still come through with subject line “[Netlify] Sales inquiry from mysitename.netlify.app”. You can remove the prefix by adding the data-remove-prefix attribute to the <input> with name="subject":

<form name="contact" method="POST" data-netlify="true">
  <input type="hidden" name="subject" data-remove-prefix
  value="Sales inquiry from mysitename.netlify.app" />
  <!-- Add other form fields here -->
</form>

Now the email subject line will be “Sales inquiry from mysitename.netlify.app”.

Existing forms will need to opt into this new behavior from HTML so that any email automation your team may have is not disrupted.

Try it out

Try out subject line customization and let us know what you think, here in the forums!

4 Likes