Skip to main content
Search

Email Templates

Customize outgoing emails with dynamic template expressions

Outgoing emails can include expressions like {{ .Recipient.FullName }}, which pull fields from the conversation, contact, recipient, and author. libredesk replaces them with real values when it sends the email.

Outgoing email templates

Edit the template under Admin → Templates → Outgoing Email Templates. It applies to every outgoing email, including replies to conversations, notifications, and other system-generated mail.

Available variables

Conversation variables

Variable Value
{{ .Conversation.ReferenceNumber }} The unique reference number of the conversation
{{ .Conversation.Subject }} The subject of the conversation
{{ .Conversation.Priority }} The priority level of the conversation
{{ .Conversation.UUID }} The unique identifier of the conversation

Contact variables

Variable Value
{{ .Contact.FirstName }} First name of the contact/customer
{{ .Contact.LastName }} Last name of the contact/customer
{{ .Contact.FullName }} Full name of the contact/customer
{{ .Contact.Email }} Email address of the contact/customer

Recipient variables

Variable Value
{{ .Recipient.FirstName }} First name of the recipient
{{ .Recipient.LastName }} Last name of the recipient
{{ .Recipient.FullName }} Full name of the recipient
{{ .Recipient.Email }} Email address of the recipient

The recipient is whoever receives the email. In replies to conversations, Recipient and Contact are the same person. They differ only in email notification templates, where the recipient is an agent.

Author variables

Variable Value
{{ .Author.FirstName }} First name of the message author
{{ .Author.LastName }} Last name of the message author
{{ .Author.FullName }} Full name of the message author
{{ .Author.Email }} Email address of the message author

The author is the sender of the message. When libredesk itself sends the email (automations, conversation continuity), the sender is the built-in System user, so these fields stay empty - otherwise emails would render "System" as the author's name.

Message variables

Variable Value
{{ .IsAIComposed }} true when the reply was written by an AI assistant rather than a person
{{ .IsContinuityEmail }} true when the email is a conversation continuity email, i.e. unread live chat messages emailed to a contact who left the chat

Use them to disclose AI replies, or to skip parts of the template that don't fit an automated email:

{{ if .IsContinuityEmail }}
  <p>You have new messages:</p>
{{ else }}
  <p>Dear {{ .Recipient.FirstName }},</p>
{{ end }}

{{ if .IsAIComposed }}
  <p>This reply was composed by an AI assistant.</p>
{{ end }}

Template functions

These work in any template, alongside the variables above.

Function Value
{{ RootURL }} Root URL of the libredesk instance, set under Admin → General
{{ SiteName }} Site name, set under Admin → General
{{ LogoURL }} URL of the uploaded logo
{{ FaviconURL }} URL of the uploaded favicon
{{ Date "2006-01-02" }} Current date and time, formatted with a Go layout. {{ Date "" }} uses the ANSIC layout

Using variables in replies and private notes

The same expressions work when an agent types them in the reply editor or a private note, and in macros. libredesk replaces them when the message is saved, so the agent sees the final text right away.

Example outgoing email template

Note:

Templates support HTML formatting. Use tags like <p> and <br /> to control spacing and line breaks. Plain text without HTML tags renders without line breaks.

<p>Dear {{ .Recipient.FirstName }},</p>

{{ template "content" . }}

<p>Best regards,<br />
{{ .Author.FullName }}</p>
---
<p>Reference: {{ .Conversation.ReferenceNumber }}</p>
{{ if .IsAIComposed }}
  <p>This reply was composed by an AI assistant.</p>
{{ end }}

How the template wraps a message

The template wraps every message an agent sends. Whatever the agent types in the editor goes where {{ template "content" . }} sits.

So if the template already opens with "Dear {{ .Recipient.FirstName }}" and closes with "Best regards, {{ .Author.FullName }}", agents should write neither a greeting nor a sign-off. They write only the body.

Correct usage

Message written in text editor:

Thank you for contacting us. I've reviewed your account and can confirm that your refund has been processed.

Email received by customer:

Dear John,

Thank you for contacting us. I've reviewed your account and can confirm that your refund has been processed.

Best regards,
Sarah Smith
---
Reference: TKT-2024-001

Duplicated greeting and sign-off

Message written in text editor:

Hello John,

Thank you for contacting us. I've reviewed your account and can confirm that your refund has been processed.

Best regards,
Sarah

Email received by customer (with unwanted duplication):

Dear John,

Hello John,

Thank you for contacting us. I've reviewed your account and can confirm that your refund has been processed.

Best regards,
Sarah

Best regards,
Sarah Smith
---
Reference: TKT-2024-001

Other template shapes

A template with no greeting means agents write their own. A template that is only the content placeholder means agents write the whole email, greeting and sign-off included. Read the active template before deciding what to write.

Email notification templates

Edit these under Admin → Templates → Email notification templates. The default outgoing email template wraps each one, and the subject line takes the same expressions as the body.

The first three go to agents, so {{ .Recipient.* }} is the agent being notified and author fields are empty. The CSAT request goes to the contact, as a normal reply in the conversation.

Each template has its own variables:

Template Variables
Conversation assigned Conversation, Contact, Recipient
Mentioned in conversation Conversation, Recipient, {{ .MentionedBy.FirstName }}, {{ .MentionedBy.LastName }}, {{ .MentionedBy.FullName }}, {{ .MentionedBy.Email }}, {{ .Message.Content }} (the private note), {{ .Message.UUID }}
SLA breach warning, SLA breached Conversation ({{ .Conversation.Priority }} is empty here), Recipient, {{ .SLA.Metric }} (First response, Resolution, or Next response), {{ .SLA.DueIn }} (time left, for the warning email), {{ .SLA.OverdueBy }} (time past the deadline, for the breach email)
CSAT request Everything an outgoing email gets (Conversation, Contact, Recipient, Author, {{ .IsAIComposed }}), plus {{ .CSATLink }} (rating page URL, append ?rating=1 to ?rating=5 for one-click rating) and {{ .CSATUUID }}

Note:

In the CSAT request, {{ .Author.* }} holds the person who resolved the conversation, and is empty when an automation resolved it.

Was this article helpful?