Email Templates
Overview
Section titled “Overview”CSDesk sends various automated emails using customizable templates. Each template has a subject line, HTML body, and plain text body with dynamic placeholders for ticket and user data.
Access: Settings → Email → Email templates
Route: /admin/email-templates
Permissions: Admin only
The Settings hub is accessible via the gear icon in the navigation rail.
Template List
Section titled “Template List”CSDesk includes 9 seeded email templates:
| Template | Purpose | Sent To | When |
|---|---|---|---|
| requester_first_invite | First-time requester sign-in link | New requester | When an account is created with an invitation |
| requester_magic_link | Requester sign-in link | Existing requester | When they request magic link |
| staff_first_invite | First-time staff sign-in link | New agent/admin | When an account is created with an invitation |
| staff_magic_link | Staff sign-in link | Existing agent/admin | When they request magic link |
| new_ticket_agent | New ticket alert | Selected agents | When ticket created (if configured under New-ticket alerts) |
| ticket_create_rejected | Ticket creation rejected | Sender with can_create_tickets = false |
When they email support |
| ticket_email_creation_disabled | Email intake disabled | Email sender | When an email would create a new ticket while email ticket creation is off |
| ticket_archived_reply | Reply to archived ticket | Email sender | When they reply to archived ticket by email and email creation is disabled |
| ticket_received | Ticket received acknowledgement | Email sender | When ticket created from email (if enabled) |
The editor shows each template by its display name, e.g. “Ticket Received Acknowledgement (Sender)”.
Editing a Template
Section titled “Editing a Template”Access Template Editor
Section titled “Access Template Editor”- Go to Settings → Email → Email templates (
/admin/email-templates) - Click Edit on the template you want to customize
Template Fields
Section titled “Template Fields”Subject Line
Section titled “Subject Line”- Type: Plain text with placeholders
- Example:
Your ticket has been received - Placeholders: Replaced at send time with actual data
HTML Body
Section titled “HTML Body”- Type: HTML
- Editor: Text field for the HTML source (no WYSIWYG)
- Purpose: Formatted email for modern email clients
- Placeholders: Use
{{ placeholder_name }}syntax
Plain Text Body
Section titled “Plain Text Body”- Type: Plain text with placeholders
- Purpose: Fallback for email clients that don’t support HTML
- Best practice: Always provide plain text version
Saving Changes
Section titled “Saving Changes”- Edit subject, HTML body, and/or plain text body
- Click Save Template
- Changes apply immediately to new emails
Available Placeholders
Section titled “Available Placeholders”Placeholders vary by template; the editor lists the ones allowed for each template. Common placeholders:
User Placeholders
Section titled “User Placeholders”| Placeholder | Description | Example |
|---|---|---|
{{ user_name }} |
User’s full name | John Smith |
{{ user_email }} |
User’s email address | john@example.com |
{{ requester_name }} |
Requester’s name (new ticket alert) | Jane Doe |
{{ requester_email }} |
Requester’s email (new ticket alert) | jane@example.com |
Ticket Placeholders
Section titled “Ticket Placeholders”| Placeholder | Description | Example |
|---|---|---|
{{ ticket_reference }} |
Ticket reference number | CSD-1234 |
{{ ticket_subject }} |
Ticket subject line (new ticket alert) | Login issue |
{{ ticket_url }} |
Link to the ticket in the desk (new ticket alert) | https://... |
{{ ticket_channel }} |
How ticket was created (new ticket alert) | email |
{{ original_subject }} |
Subject of the sender’s email (rejections, acknowledgement) | Help needed |
Organization Placeholders
Section titled “Organization Placeholders”| Placeholder | Description | Example |
|---|---|---|
{{ organization_name }} |
Organization name | Acme Corp |
System Placeholders
Section titled “System Placeholders”| Placeholder | Description | Example |
|---|---|---|
{{ app_name }} |
Application name | CSDESK |
{{ support_email }} |
Support email address (rejections, acknowledgement) | support@example.com |
{{ login_url }} |
Magic link URL (sign-in templates) | https://.../login/t/... |
{{ expires_minutes }} |
Magic link expiry in minutes (sign-in templates) | 20 |
{{ expires_at }} |
Magic link expiry time (sign-in templates) | |
{{ user_role }} |
Role of the user (sign-in templates) | requester |
{{ portal_url }} |
Customer portal home (rejection notices) | https://.../portal |
Template-Specific Placeholders
Section titled “Template-Specific Placeholders”Not all placeholders are available in all templates. Saving a template that uses a placeholder not allowed for it is rejected. Allowed placeholders without a value render as empty text.
Template Examples
Section titled “Template Examples”requester_magic_link (Simplified)
Section titled “requester_magic_link (Simplified)”Subject:
Your CSDESK sign-in linkHTML Body:
<p>Hello {{ user_name }},</p>
<p>Click the link below to sign in to {{ app_name }}:</p>
<p><a href="{{ login_url }}">Sign in to CSDESK</a></p>
<p>This link expires in {{ expires_minutes }} minutes and can only be used once.</p>
<p>If you didn't request this, you can safely ignore this email.</p>
<p>Thanks,<br>The CSDESK Team</p>Plain Text Body:
Hello {{ user_name }},
Click the link below to sign in to {{ app_name }}:
{{ login_url }}
This link expires in {{ expires_minutes }} minutes and can only be used once.
If you didn't request this, you can safely ignore this email.
Thanks,The CSDESK Teamticket_received (Acknowledgement)
Section titled “ticket_received (Acknowledgement)”Subject:
Your ticket has been receivedHTML Body:
<p>Hello {{ user_name }},</p>
<p>Thank you for contacting us. We have created ticket <strong>{{ ticket_reference }}</strong> for your request:</p>
<p>{{ original_subject }}</p>
<p>Our team will review your ticket and respond as soon as possible. You can reply to this email to add more information to the ticket.</p>
<p>This is an automated acknowledgement from {{ app_name }} ({{ support_email }}).</p>new_ticket_agent (Alert)
Section titled “new_ticket_agent (Alert)”Subject:
New ticket: {{ ticket_subject }}HTML Body:
<p>A new ticket has been created:</p>
<p><strong>Reference:</strong> {{ ticket_reference }}<br><strong>Subject:</strong> {{ ticket_subject }}<br><strong>Requester:</strong> {{ requester_name }} ({{ requester_email }})<br><strong>Organization:</strong> {{ organization_name }}</p>
<p><a href="{{ ticket_url }}">View Ticket</a></p>Testing Templates
Section titled “Testing Templates”Preview
Section titled “Preview”- Edit template
- Click Preview button
- The rendered template is shown with sample data, including your unsaved edits
- Check formatting and placeholder replacement
Note: Preview uses sample data, not real ticket/user data.
Send Test Email
Section titled “Send Test Email”- Edit and save the template
- Click Send Test Email to Me
- Email sent to your own address, rendered with sample data
- Check inbox for actual rendered email
Best practice: Always send test email before deploying changes to production.
Validation
Section titled “Validation”Required Placeholders
Section titled “Required Placeholders”Only the four sign-in templates (first invite and sign-in link, for requesters and staff) have a required placeholder:
- Magic link templates: Must include
{{ login_url }}in both the HTML and the plain text body
Validation: Checked on save. A missing {{ login_url }} or a placeholder that is not allowed for the template causes a save error. The subject is limited to 255 characters.
HTML Sanitization
Section titled “HTML Sanitization”HTML bodies are sanitized on save, and again when an email is rendered:
- Dangerous tags and attributes removed
- Safe HTML formatting preserved (
<p>,<a>,<strong>,<em>,<br>, tables) - Test thoroughly in multiple email clients
Best Practices
Section titled “Best Practices”Subject Lines
Section titled “Subject Lines”- Be descriptive: Recipients should know what the email is about
- Use placeholders: Include ticket reference or user name for context
- Keep short: < 60 characters ideal for mobile preview
HTML Body
Section titled “HTML Body”- Use inline CSS: Email clients often strip
<style>tags - Keep formatting simple: Tables and inline styles work best
- Test in multiple clients: Gmail, Outlook, Apple Mail
- Responsive design: Use
max-widthfor mobile compatibility
Example inline style:
<p style="color: #333; font-family: Arial, sans-serif; font-size: 14px;"> Hello {{ user_name }},</p>Plain Text Body
Section titled “Plain Text Body”- Always provide: Required for accessibility and text-only clients
- Match HTML content: Should convey same information
- Use line breaks: Keep lines < 78 characters
- No formatting: No bold, italic, links are plain text
Placeholder Usage
Section titled “Placeholder Usage”- Test all placeholders: Ensure they render correctly
- Handle missing data: Some placeholders may be empty (e.g.,
organization_namefor unmatched senders) - Don’t over-use: Too many placeholders can make templates hard to maintain
Localization
Section titled “Localization”CSDesk does not have built-in multi-language support for templates:
- Templates are in one language (English by default)
- If you have multilingual customers, consider:
- Keeping language simple and clear
- Using international date/time formats
- Avoiding idioms or colloquialisms
Rate Limiting
Section titled “Rate Limiting”Some templates have rate limiting:
ticket_create_rejected, ticket_email_creation_disabled and ticket_archived_reply:
- Limit: Once per sender per calendar day, shared by all three
- Purpose: Prevent reply loops and spam
- Stored in:
ticket_create_rejectionstable
Magic links:
- Limit: 6 per email per hour
- Cooldown: 120 seconds server-side between requests
- Purpose: Prevent abuse
Troubleshooting
Section titled “Troubleshooting”Placeholder not replaced
Section titled “Placeholder not replaced”Check:
- Is placeholder name correct? (case-sensitive, exact match)
- Is placeholder supported in this template?
- Is data available? (e.g.,
organization_nameempty for unmatched senders)
Solution: Review available placeholders list and test with send test email.
HTML rendering incorrectly
Section titled “HTML rendering incorrectly”Common issues:
- Broken layout: Use inline CSS, avoid external stylesheets
- Images not showing: Use absolute URLs for images
- Links not working: Ensure URLs are complete (include
https://)
Solution: Test in multiple email clients, simplify HTML.
Plain text version ignored
Section titled “Plain text version ignored”Cause: Most email clients prefer HTML when both are provided
Solution: This is expected behavior. Plain text is fallback only.
Template changes not applied
Section titled “Template changes not applied”Check:
- Did you click Save Template?
- Did the save show an error (for example a placeholder that is not allowed)?
- Check logs for errors during send
Solution: Clear browser cache, send test email again.
Database Storage
Section titled “Database Storage”Table: email_templates
Columns:
key(unique identifier, e.g.,requester_magic_link)name(display name)subjectbody_htmlbody_textupdated_by(last editor)created_at,updated_at
Seeding: Templates are seeded via EmailTemplateSeeder on installation.
Related Topics
Section titled “Related Topics”- Workflow Settings - Configure ticket acknowledgement
- New Ticket Alerts - Configure agent notifications
- Email Settings - Microsoft Graph configuration