Email Templates Feature

Create and manage reusable email templates

Features

The email templates feature allows users to create, manage, and reuse email templates for their campaigns, providing a streamlined way to maintain consistent branding and messaging.

Features

Template Management

  • Create Templates: Design custom email templates with HTML and plain text versions
  • Edit Templates: Modify existing templates with real-time preview
  • View Templates: Preview how templates will look to recipients
  • Delete Templates: Remove unwanted templates with confirmation
  • Duplicate Templates: Create copies of existing templates for variation

Template Content

  • HTML Content: Rich HTML email content with full styling support
  • Plain Text: Optional plain text version for accessibility
  • Variable Substitution: Dynamic content using template variables
  • Subject Lines: Customizable subject lines with variable support

Template Organization

  • Default Template: Set one template as default for new campaigns
  • Search & Filter: Find templates by name or subject
  • Template Library: Organized view of all user templates
  • Creation Date: Track when templates were created and last modified

Preview & Testing

  • Live Preview: Real-time preview while editing
  • Email Client Simulation: See how emails will render
  • Variable Preview: Preview with sample data
  • Responsive Design: Templates work across email clients

Technical Implementation

Database Schema

The emailTemplates table stores:

  • Template metadata (name, subject, creation dates)
  • HTML and plain text content
  • Default template status
  • User association via createdByClerk

File Structure

app/dashboard/studio/templates/
├── page.tsx                    # Templates listing page
├── new/
│   └── page.tsx               # Create new template
└── [id]/
    ├── page.tsx               # View template
    └── edit/
        └── page.tsx           # Edit template

Template Variables

Available variables for dynamic content:

  • {{firstName}} - Contact's first name
  • {{lastName}} - Contact's last name
  • {{email}} - Contact's email address
  • {{company}} - Contact's company
  • {{unsubscribeUrl}} - Unsubscribe link

Default Template

A comprehensive HTML template is provided with:

  • Responsive design
  • Professional styling
  • Variable placeholders
  • Unsubscribe link
  • Best practices implementation

API Endpoints

Queries

  • getUserEmailTemplates - Get all templates for a user
  • getEmailTemplate - Get specific template by ID
  • getDefaultTemplate - Get user's default template

Mutations

  • createEmailTemplate - Create new template
  • updateEmailTemplate - Update existing template
  • deleteEmailTemplate - Remove template
  • duplicateEmailTemplate - Copy existing template

Security Features

Access Control

  • Users can only access their own templates
  • Template ownership verification on all operations
  • Secure template ID validation

Data Validation

  • Required field validation (name, subject, HTML content)
  • Content sanitization for XSS prevention
  • Input length limits for performance

Usage Workflow

Creating a Template

  1. Navigate to Dashboard → Studio → Templates
  2. Click "New Template"
  3. Fill in template name and subject
  4. Design HTML content (default template provided)
  5. Optional: Add plain text version
  6. Optional: Set as default template
  7. Preview and save

Managing Templates

  1. View all templates in organized grid
  2. Search templates by name or subject
  3. Quick actions: View, Edit, Duplicate, Delete
  4. Set default template with star indicator
  5. Track creation and modification dates

Using Templates

  1. Templates integrate with campaign creation
  2. Default template auto-loads in new campaigns
  3. Variables automatically replaced with contact data
  4. HTML and plain text versions sent appropriately

Best Practices

Email Design

  • Use inline CSS for better email client compatibility
  • Keep subject lines under 50 characters
  • Always include plain text version
  • Test across multiple email clients
  • Include unsubscribe link for compliance

Template Organization

  • Use descriptive names for easy identification
  • Set appropriate default template
  • Regular cleanup of unused templates
  • Version control through duplication

Content Guidelines

  • Personalize with template variables
  • Maintain consistent branding
  • Clear call-to-action buttons
  • Mobile-responsive design
  • Accessible content structure

Integration Points

Campaign Creation

Templates integrate seamlessly with the campaign system:

  • Auto-load default template in new campaigns
  • Template picker for campaign creation
  • Variable substitution during send
  • Template metrics and performance tracking

Branding System

Templates work with the branding feature:

  • Company logo integration
  • Brand color consistency
  • Automated branding application
  • Corporate identity maintenance

Future Enhancements

Planned Features

  • Template Categories: Organize templates by type/purpose
  • Shared Templates: Team template sharing capabilities
  • Template Analytics: Track template usage and performance
  • A/B Testing: Split test different template versions
  • Template Marketplace: Pre-built professional templates
  • Visual Editor: Drag-and-drop template builder
  • Template Export/Import: Backup and share templates

The email templates feature provides a robust foundation for professional email marketing campaigns with enterprise-level functionality and user-friendly management.

We use cookies

We use cookies to enhance your experience, analyze site usage, and assist in our marketing efforts. You can manage your preferences or learn more in our Cookie Policy.