Create an Email Template
Build a beautiful, reusable email template for your emails.
Overview
This tutorial guides you through creating a professional email template. Youβll learn:
- How to quickly generate templates using AI
- How to import pre-built templates from the Template Gallery
- How to manually build templates with the drag-and-drop designer
- Working with dynamic variables for personalization
- Preview and publish your template
By the end, youβll have a reusable order confirmation template that you can send via the API.
Prerequisites
Before starting, make sure you have:
- An active FormaMail account
- Access to the dashboard
- (Optional) A logo or images for your template
Choose Your Approach
FormaMail offers three ways to create templates. Choose the one that works best for you:
| Approach | Best For | Time |
|---|---|---|
| AI Generation | Quick start, common use cases | ~1 minute |
| Template Gallery | Professional designs, inspiration | ~2 minutes |
| Manual Design | Full customization, unique layouts | ~10-15 minutes |
Recommendation: Start with AI generation or the Template Gallery to get up and running quickly. You can always customize the result afterward.
Option A: Generate with AI (Fastest)
Let AI create your template in seconds:
Step 1: Start AI Generation
- Log in to your FormaMail Dashboard
- Go to Templates β Create Template
- Click Generate with AI
Step 2: Describe Your Template
Enter a natural language description of what you need. Be specific for better results:
Example prompts:
βOrder confirmation email with company logo header, order number, list of purchased items with prices, order total, shipping address, and a track order buttonβ
βWelcome email for new SaaS users with a friendly greeting, 3 key features with icons, and a get started buttonβ
βPassword reset email with security warning, reset link button, and note about link expirationβ
Step 3: Review and Customize
- AI generates a complete template with:
- Professional layout and styling
- Appropriate components
- Pre-configured variables (e.g.,
{{customerName}},{{orderNumber}})
- Review the generated template in the designer
- Make any adjustments:
- Update colors to match your brand
- Replace placeholder logo with your own
- Modify text content
- Add or remove sections
Step 4: Publish
- Click Preview to test the template
- Click Save to save your draft
- Click Publish to make it available for sending
- Copy the Template ID for use in your code
Pro tip: You can continue to refine the template with AI. Just describe the changes you want: βAdd a footer with social media linksβ or βMake the header background blueβ.
Option B: Import from Template Gallery
Browse and import professionally designed templates:
Step 1: Open the Template Gallery
- Log in to your FormaMail Dashboard
- Go to Templates β Template Gallery
Step 2: Find a Template
Browse by category:
- Transactional: Order confirmations, shipping updates, receipts
- Marketing: Newsletters, promotions, announcements
- Notifications: Alerts, reminders, account updates
- Welcome: Onboarding, welcome series
Or search for specific templates like βinvoiceβ, βpassword resetβ, or βnewsletterβ.
Step 3: Preview and Import
- Click on a template to preview it
- Review the included variables and structure
- Click Import to add it to your templates
Step 4: Customize
- The template opens in the designer
- Update the branding:
- Replace the logo
- Adjust colors to match your brand
- Update company information
- Modify content as needed
- Add or remove sections
Step 5: Publish
- Click Preview to test
- Click Save and Publish
- Copy the Template ID
Option C: Build Manually (Full Control)
For complete customization, build your template from scratch using the drag-and-drop designer.
Tutorial: Create an Order Confirmation Template
Step 1: Navigate to Templates
- Log in to your FormaMail Dashboard
- Click Templates in the sidebar
- Click the Create Template button
- Select Email Template
Youβll be taken to the template designer with a blank canvas.
Step 2: Set Template Details
Before designing, set the basic template information:
- Click the Settings icon (gear) in the top toolbar
- Fill in the template details:
- Name:
Order Confirmation - Slug:
order-confirmation(auto-generated, used in API) - Description:
Sent to customers after successful order placement - Subject:
Order Confirmed - #{{orderNumber}}
- Name:
Variable in Subject: Notice {{orderNumber}} in the subject line. This will be replaced with the actual order number when you send the email.
Step 3: Add a Header Section
Letβs start with a branded header:
-
From the Component Library (left panel), drag a Container onto the canvas
-
With the container selected, set these properties in the right panel:
- Background Color:
#1a1a2e(dark blue) - Padding:
24px
- Background Color:
-
Drag an Image component into the container
-
Click Select from Gallery (or enter your logo URL)
-
Set image properties:
- Width:
150px - Alignment:
Center - Alt Text:
Company Logo
- Width:
-
Drag a Heading component below the image
-
Set heading properties:
- Content:
Order Confirmed! - Level:
H1 - Text Color:
#ffffff - Text Align:
Center
- Content:
Step 4: Add the Order Summary
Now add the main content area:
-
Drag a new Container below the header
-
Set container properties:
- Background Color:
#ffffff - Padding:
32px
- Background Color:
-
Add a Text component with:
- Content:
Hi {{customerName}}, - Font Size:
18px - Margin Bottom:
16px
- Content:
-
Add another Text component:
- Content:
Thank you for your order! We're preparing your items for shipment. - Font Size:
16px - Text Color:
#666666
- Content:
Step 5: Add Order Details Box
Create a highlighted box for order information:
-
Drag a Container inside the content area
-
Set properties:
- Background Color:
#f8f9fa - Border Radius:
8px - Padding:
20px - Margin Top:
24px
- Background Color:
-
Add a Heading component:
- Content:
Order Details - Level:
H3 - Margin Bottom:
16px
- Content:
-
Add Text components for each detail:
Order Number: {{orderNumber}}
Order Date: {{orderDate}}
Payment Method: {{paymentMethod}}Use the Divider component between sections for visual separation.
Step 6: Add Order Items with Loop
For dynamic order items, use a Loop component:
-
Drag a Loop component into the content area
-
Set the Data Source to
{{items}} -
Inside the loop, add a Columns component (2 columns)
-
In the left column, add:
- Text:
{{item.name}} - Text:
Qty: {{item.quantity}}(smaller, gray text)
- Text:
-
In the right column, add:
- Text:
{{item.price}} - Text Align:
Right - Font Weight:
Bold
- Text:
Loop Variables: Inside a loop, access item properties with {{item.propertyName}}. The item prefix is automatically added.
Step 7: Add Order Total
Below the items loop:
-
Add a Divider component
-
Add a Columns component (2 columns)
-
Left column - Text:
- Content:
Subtotal: - Font Weight:
Normal
- Content:
-
Right column - Text:
- Content:
{{subtotal}} - Text Align:
Right
- Content:
-
Repeat for Shipping and Tax
-
Add another row for Total with:
- Font Size:
18px - Font Weight:
Bold - Content (left):
Total: - Content (right):
{{total}}
- Font Size:
Step 8: Add Call-to-Action Button
Add a button for customers to track their order:
- Drag a Button component below the totals
- Set properties:
- Text:
Track Your Order - URL:
{{trackingUrl}} - Background Color:
#4f46e5(indigo) - Text Color:
#ffffff - Padding:
12px 32px - Border Radius:
6px - Alignment:
Center - Margin Top:
24px
- Text:
Step 9: Add Footer
Create a professional footer:
-
Drag a new Container for the footer
-
Set properties:
- Background Color:
#f8f9fa - Padding:
24px - Text Align:
Center
- Background Color:
-
Add Text component:
- Content:
Questions? Contact us at {{supportEmail}} - Font Size:
14px - Text Color:
#666666
- Content:
-
Add another Text:
- Content:
Β© {{__CURRENT_YEAR__}} {{companyName}}. All rights reserved. - Font Size:
12px - Text Color:
#999999
- Content:
System Variables: {{__CURRENT_YEAR__}} is a system-provided variable that automatically inserts the current year. No need to pass it when sending!
Step 10: Review Variables
Click the Variables tab in the right panel to see all detected variables:
| Variable | Type | Description |
|---|---|---|
customerName | String | Customerβs name |
orderNumber | String | Order identifier |
orderDate | String | Date of order |
paymentMethod | String | Payment method used |
items | Array | Order line items |
subtotal | String | Order subtotal |
shipping | String | Shipping cost |
tax | String | Tax amount |
total | String | Order total |
trackingUrl | String | Order tracking link |
supportEmail | String | Support email |
companyName | String | Your company name |
Step 11: Preview Your Template
Test how your template looks:
- Click the Preview button in the toolbar
- Switch between Desktop and Mobile views
- Click Test Data to enter sample values
- Verify all variables render correctly
Example test data:
{
"customerName": "John Doe",
"orderNumber": "ORD-12345",
"orderDate": "December 7, 2025",
"paymentMethod": "Visa ending in 4242",
"items": [
{ "name": "Wireless Headphones", "quantity": 1, "price": "$99.99" },
{ "name": "Phone Case", "quantity": 2, "price": "$29.98" }
],
"subtotal": "$129.97",
"shipping": "$5.99",
"tax": "$10.80",
"total": "$146.76",
"trackingUrl": "https://example.com/track/12345",
"supportEmail": "support@example.com",
"companyName": "Acme Electronics"
}Step 12: Save and Publish
- Click Save to save your draft
- Click Publish to make the template available for sending
Draft vs Published: Only published templates can be used to send emails. You can continue editing a published template - changes wonβt affect sent emails until you publish again.
- Copy your Template ID for use in your code:
- UUID:
550e8400-e29b-41d4-a716-446655440000 - Slug:
order-confirmation
- UUID:
Using Your Template
Now send emails using your new template:
const response = await axios.post(
'https://api.formamail.com/api/emails/send',
{
templateId: 'order-confirmation', // or use the UUID
to: [{ email: 'customer@example.com', name: 'John Doe' }],
variables: {
customerName: 'John Doe',
orderNumber: 'ORD-12345',
orderDate: 'December 7, 2025',
paymentMethod: 'Visa ending in 4242',
items: [
{ name: 'Wireless Headphones', quantity: 1, price: '$99.99' },
{ name: 'Phone Case', quantity: 2, price: '$29.98' }
],
subtotal: '$129.97',
shipping: '$5.99',
tax: '$10.80',
total: '$146.76',
trackingUrl: 'https://yoursite.com/track/12345',
supportEmail: 'support@yourcompany.com',
companyName: 'Your Company'
}
},
{
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
}
);Component Reference
Commonly Used Components
| Component | Use Case | Key Properties |
|---|---|---|
| Text | Paragraphs, descriptions | content, fontSize, color, align |
| Heading | Titles, section headers | content, level (H1 to H6), color |
| Button | Call-to-action links | text, url, backgroundColor, color |
| Image | Logos, product images | src, alt, width, alignment |
| Container | Group components, backgrounds | backgroundColor, padding, borderRadius |
| Columns | Side-by-side layouts | columnCount (2 to 4), gap |
| Divider | Visual separation | color, thickness, margin |
| Loop | Repeat for arrays | dataSource, itemVariable |
| Conditional | Show/hide content | condition |
Layout Tips
Two-Column Layout Example:
Columns (2 columns)
βββ Column 1
β βββ Image (product photo)
βββ Column 2
βββ Heading (product name)
βββ Text (description)
βββ Button (buy now)Card Pattern:
Container (background, padding, border-radius)
βββ Heading
βββ Text
βββ ButtonBest Practices
Design
- Keep it simple - Avoid overly complex layouts
- Mobile-first - Design for mobile, then adjust for desktop
- Consistent spacing - Use uniform padding and margins
- Brand colors - Stick to 2-3 primary colors
- Readable fonts - 14-16px for body text, 24-32px for headings
Variables
- Descriptive names - Use
customerFirstNamenotfn - Provide defaults - Handle missing variables gracefully
- Test thoroughly - Preview with sample data before publishing
- Document variables - Keep a list of required variables
Email Client Compatibility
- Use web-safe fonts - Arial, Helvetica, Georgia, Times New Roman
- Limit width - Max 600px for main content
- Include alt text - For all images
- Test across clients - Gmail, Outlook, Apple Mail, mobile
Advanced Features
Conditional Content
Show content based on conditions:
- Drag a Conditional component
- Set Condition:
{{hasDiscount}} - Add content inside that only shows when condition is true
Example: Show discount badge only for discounted orders:
Condition: {{hasDiscount}}
βββ Container (badge style)
βββ Text: "You saved {{discountAmount}}!"Nested Objects
Access nested data with dot notation:
Customer: {{customer.name}}
Address: {{customer.address.street}}, {{customer.address.city}}Formatting
Use JavaScript expressions for formatting:
Date: {{formatDate(orderDate, 'MMMM D, YYYY')}}
Price: {{formatCurrency(amount, 'USD')}}Iterative AI Editing
After creating a template (manually or via AI), you can use AI to make changes:
- Open your template in the designer
- Click Edit with AI
- Describe the changes you want:
- βAdd a promotional banner at the topβ
- βChange the button color to greenβ
- βAdd a section showing related productsβ
- AI applies the changes while preserving your existing content
See the AI Template Editing tutorial for more advanced AI editing techniques.
Troubleshooting
Template Not Saving
Solutions:
- β Check for validation errors in components
- β Ensure all required fields are filled
- β Check your internet connection
- β Try refreshing and re-saving
Variables Not Rendering
Solutions:
- β
Verify syntax:
{{variableName}}with double curly braces - β Check variable names are exact (case-sensitive)
- β Ensure the variable is passed when sending
- β Check the Variables tab for detected variables
Layout Issues on Mobile
Solutions:
- β Use responsive column layouts (they stack on mobile)
- β Keep button text short
- β Use percentage widths for images
- β Preview in mobile mode before publishing
Images Not Displaying
Solutions:
- β Use HTTPS URLs for external images
- β Upload images to Asset Gallery for best results
- β Include alt text for broken image fallback
- β Keep image file sizes small (under 200KB)
Template Ideas
Looking for inspiration? Here are common template types:
Transactional Emails
- Order confirmation
- Shipping notification
- Password reset
- Account verification
- Receipt/invoice
Marketing Emails
- Welcome series
- Newsletter
- Product announcement
- Sale notification
- Re-engagement
Notification Emails
- Appointment reminder
- Payment due
- Subscription expiring
- Activity summary
- Alert notification
Next Steps
Now that youβve created your first template:
- Send Your First Email - Use your template to send emails
- Generate PDF Invoices - Create PDF attachments
- Send Bulk Emails - Send personalized emails at scale
- AI Template Generation - Let AI create templates for you