Custom Email Subjects
Customize notification email subject lines with dynamic content
By default, Static Forms sends notification emails with a standard subject line. You can customize the email subject to include dynamic content from your form submissions, making it easier to identify and prioritize emails in your inbox.
Setting Custom Subjects
To set a custom email subject, add a hidden field named subject to your form:
Dynamic Subjects with Template Variables
You can include form field values in the subject line using template variables. Static Forms will replace these variables with actual form data:
Template Variable Syntax
Use double curly braces to include form field values in your subject:
{{fieldname}}- Replaced with the value from the form field- Field names are case-sensitive
- If a field doesn't exist or is empty, the variable is replaced with an empty string
Subject Examples
Here are some practical examples of custom email subjects:
Simple Static Subject
Result: "Contact Form Submission"
With Sender Name
Result: "Message from John Doe"
With Multiple Fields
Result: "Contact: John Doe (john@example.com)"
With Inquiry Type
Result: "[Support] Message from John Doe"
JavaScript Dynamic Subjects
You can set the subject dynamically using JavaScript based on form data or other conditions:
Best Practices
Keep It Concise
Email subjects should be brief and descriptive. Long subjects may be truncated by email clients.
Include Key Information
Include the most important information (like sender name or inquiry type) to help you quickly identify emails.
Use Prefixes for Organization
Use prefixes like [Support], [Sales], or [General] to help organize and filter emails.
Handle Missing Fields
If a template variable field is empty, it will be replaced with an empty string. Consider using fallback text or ensuring required fields are filled.
Common Use Cases
Custom subjects are useful for:
- Prioritization: Include priority level or urgency in the subject
- Organization: Add categories or tags to help filter emails
- Quick Identification: Include sender name or email for quick recognition
- Context: Add inquiry type or form name to understand the submission source
Troubleshooting
Template Variables Not Working
- Verify field names match exactly (case-sensitive)
- Check that the field exists in your form
- Ensure the field has a value in the submission
- Use double curly braces:
{{fieldname}}
Subject Not Changing
- Verify the field is named exactly
subject - Check that the field is included in the form submission
- Ensure the field value is set before form submission
Default Subject
If you don't specify a custom subject, Static Forms uses a default subject line like "New Form Submission". Adding a custom subject helps you better organize and identify emails.