> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trophy.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Emails

> Learn how to use emails in a gamified product experience with Trophy.

export const PlanBadge = ({plan}) => {
  return <div>
      <span style={{
    display: 'inline-flex',
    alignItems: 'center',
    borderRadius: '0.375rem',
    paddingLeft: '0.5rem',
    paddingRight: '0.5rem',
    paddingTop: '0.25rem',
    paddingBottom: '0.25rem',
    fontSize: '0.75rem',
    lineHeight: '1rem',
    fontWeight: plan === 'pro' ? '600' : '500',
    backgroundColor: plan === 'free' ? '#fefce8' : '#f0fdf4',
    color: plan === 'free' ? '#ca8a04' : '#4CC74A',
    boxShadow: plan === 'free' ? 'inset 0 0 0 1px rgba(200, 138, 4, 0.4)' : plan === 'starter' ? 'inset 0 0 0 1px rgba(78, 200, 76, 0.4)' : 'inset 0 0 0 1px #4CC74A',
    backgroundImage: plan === 'pro' ? 'linear-gradient(to bottom right, #bbf7d0, #f0fdf4, #bbf7d0)' : 'none'
  }}>
        {plan.charAt(0).toUpperCase() + plan.slice(1)}
      </span>
    </div>;
};

Trophy can send automated emails to users based on key triggers without requiring any code. Here we'll look at what these triggers are, and how they can form part of your product's gamification experience.

<h2 id="types-of-emails">
  Types Of Emails
</h2>

Trophy supports 4 types of emails, each of which is designed to suit a common scenario in building gamification experiences.

All emails are optional, but all four can be used simultaneously and can be controlled from the [Emails](https://app.trophy.so/emails/configure) page in the Trophy dashboard.

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-15/4" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/email_types.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=b2f4caa6a870bc39ae4229118c784402" data-path="assets/features/emails/email_types.mp4" />
</Frame>

* **Achievement emails** are sent to users each time they unlock an [Achievement](/features/achievements).
* **Recap emails** are sent to users on a pre-defined frequency to summarize progress. Recap Emails can be configured to be sent daily, weekly, monthly or yearly depending on your use case.
* **Reactivation emails** are sent to users after they become inactive with the goal of bringing them back to your app.
* **Streak emails** are automatically sent to users reminding them to extend their [Streak](/features/streaks).

<h2 id="sending-emails">
  Sending Emails
</h2>

To start sending emails with Trophy, you'll need to verify your domain and add and activate email templates for the types you want to send.

<Tip>
  Users can control which email notifications they receive through Trophy's
  [user preferences API](/features/users#notification-preferences). This allows
  you to build a preference center in your application where users can opt in or
  out of specific email types.
</Tip>

<h3 id="domain-verification">
  Domain Verification
</h3>

Trophy supports sending emails from your own domain out-of-the-box. There are two ways to set this up, Single Sender Verification and DNS Verification.

All domain settings can be found in the [Domains](https://app.trophy.so/emails/domains) page in the Trophy dashboard.

<Tip>
  If you're looking to get set up quickly we recommend starting with Single
  Sender Verification then setting up DNS Verification when you're ready to move
  to production.
</Tip>

<CardGroup cols={2}>
  <Card title="Sender Verification" icon="check" href="#sender-verification-basic">
    Quickly verify a single email address
  </Card>

  <Card title="DNS Verification" icon="lock" href="#dns-verification-advanced">
    Recommended for production use
  </Card>
</CardGroup>

<h4 id="sender-verification-basic">
  Sender Verification (Basic)
</h4>

During onboarding you'll be prompted to set up Sender Verification. This is a super simple way to quickly verify a single email address that you want to use with Trophy without needing to change any code or DNS settings.

You'll be prompted to enter the email address, from name and reply-to email that you'd like Trophy to use when sending emails:

<Frame>
  <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/sender_verification.jpg?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=522285ec5dcf3a3d676841e9d343bae9" data-path="assets/features/emails/sender_verification.jpg" />
</Frame>

Trophy will send a verification email to that address. Simply click the link in the email to let Trophy know what you own the address and you'll be good to go.

<Note>
  The email you receive will come from our email provider, Postmark. So keep an
  eye out for 'Postmark Support' in your inbox!
</Note>

Sender Verification is great for getting started but is limited in that you won't benefit from your existing email reputation and can only send emails from one address.

Also, if you want to change the address in the future, you'll have to go through Sender Verification again which you can do in the [settings screen](https://app.trophy.so/integration?tab=domains).

<h4 id="dns-verification-advanced">
  DNS Verification (Advanced)
</h4>

<Note>
  This feature is available on the [Starter](/account/billing#starter-plan)
  plan.
</Note>

For production use we recommend DNS Verification. Once set up, this allows you to configure Trophy to send emails from any address on your domain. So if you want to change the address in future, you won't need to verify again.

Completing DNS verification also gives you the full benefits of any existing domain reputation and is the best way to make sure your emails avoid the spam folder.

This does however require adding a couple of new entries into your DNS to allow Trophy to verify you own the domain.

Follow the steps below to set up DNS verification:

<Steps>
  <Step title="Head to the Emails page">
    Within the Emails page, you'll find the [Domains](https://app.trophy.so/emails/domains) tab which is where you'll configure everything related to the email domain Trophy will use to send emails on your behalf.
  </Step>

  <Step title="Configure your domain">
    Head down to the DNS Verification section and enter the domain you want to set up with Trophy.

    You can also also configure a custom Return Path. This is where Trophy will forward notifications of bounced emails to help you investigate deliverability issues:

    <Frame>
      <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/dns-verification-1.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=77c8803b09b514e54c4c549cc9e3feb2" data-path="assets/features/emails/dns-verification-1.png" />
    </Frame>
  </Step>

  <Step title="Set up your DNS records">
    Once you've entered your email domain, Trophy will provide you with details for two new DNS records that you'll need to add to your DNS provider.

    <Frame>
      <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/dns-verification-2.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=2c555f7a8effe4984a7f65c3089e396c" data-path="assets/features/emails/dns-verification-2.png" />
    </Frame>

    * First is the **DKIM** record which is used by inbox providers like Google to verify the authenticity of emails. Enter the name and value provided as a new **TXT** record in your DNS provider.
    * Second is the **Return Path** record. This is used to forward notifications of email bounces to your domain. Enter the name and value provided as a new **CNAME** record in your DNS provider.

    Here are the pages for the most common DNS providers on how to set up new records:

    <AccordionGroup>
      <Accordion title="GoDaddy">
        [Add a TXT record](https://www.godaddy.com/en-uk/help/add-a-txt-record-19232)
        [Add a CNAME record](https://www.godaddy.com/en-uk/help/add-a-cname-record-19236)
      </Accordion>

      <Accordion title="Cloudflare">
        [Add DNS records](https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/#create-dns-records)
      </Accordion>

      <Accordion title="NameCheap">
        [Add a CNAME record](https://www.namecheap.com/support/knowledgebase/article.aspx/9646/2237/how-to-create-a-cname-record-for-your-domain/)
        [Add a TXT record](https://www.namecheap.com/support/knowledgebase/article.aspx/317/2237how-do-i-add-txtspfdkimdmarc-records-for-my-domain/#:~:text=this%20guide%20.-,DKIM%20records,-DKIM%20\(DomainKeys%20Identified\))
      </Accordion>
    </AccordionGroup>

    <Warning>Note: If you're using a proxy like Cloudflare, make sure to turn  it off for these records or Trophy won't be able to properly verify them.</Warning>
  </Step>

  <Step title="Verify DNS records">
    Once you've added the two records into your DNS settings, hit the refresh icon and Trophy will attempt to verify the records for you.

    Usually Trophy can verify records within a few minutes but bear in mind that DNS changes can take up to a few hours to fully propogate.

    If you see the following alert, the records may not have propogated yet, or there may be an issue with your setup.

    <Frame>
      <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/dns-verification-3.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=d0ec476616bbc0a72fc6a35811ed9082" data-path="assets/features/emails/dns-verification-3.png" />
    </Frame>

    Once you're sure everything's set up correctly in your DNS provider, hit refresh and Trophy will attempt to verify your DNS records once again.

    As soon as you see the following message, you know everything's verified:

    <Frame>
      <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/dns-verification-4.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=9abb922a081054c54cfd47ae4a74d07e" data-path="assets/features/emails/dns-verification-4.png" />
    </Frame>
  </Step>

  <Step title="Configure your sending address">
    Once your DNS records are verified, it's time to choose the email address you want to send emails from. Note that now you've fully verified your domain, you can change this address whenever you like without impacting deliverability.

    Simply enter the email address you want Trophy to send from, the name to show to users in the inbox when they receive emails and a support email address they can use to contact you if needed:

    <Frame>
      <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/dns-verification-5.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=54d250ae7c9b1884a68150984be5e29a" data-path="assets/features/emails/dns-verification-5.png" />
    </Frame>
  </Step>
</Steps>

<h3 id="email-triggers">
  Email Triggers
</h3>

On the [email configuration](https://app.trophy.so/emails/configure) page, each email type has its own section. Add templates under the relevant type and activate one to start sending.

<h4 id="recap-emails">
  Recap Emails
</h4>

**Recap** emails send weekly or monthly progress reports to users. You can change the frequency of these emails on the [integration](https://app.trophy.so/integration) page using the **Aggregation Period** setting.

<Frame>
  <img height="200" width="100%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/recap_emails.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=0f90e35cb1dc4ce31b2583976a8be1ce" data-path="assets/features/emails/recap_emails.png" />
</Frame>

<h4 id="reactivation-emails">
  Reactivation Emails
</h4>

**Reactivation** emails send win-back messages to users after they become inactive. These emails are sent according to the following timeline:

* After 3 days of inactivity
* After 5 days of inactivity
* After 7 days of inactivity
* After 14 days of inactivity
* After 30 days of inactivity

<Frame>
  <img height="200" width="30%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/reactivation_emails.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=fb6f4de841cecc79ddd67abd135e0db7" data-path="assets/features/emails/reactivation_emails.png" />
</Frame>

<h4 id="streak-emails">
  Streak Emails
</h4>

**Streak** emails remind users to extend their streak before it expires. These emails are sent according to the streak frequency you configured on the [streaks page](https://app.trophy.so/streaks):

* If your app uses a **daily streak**, this email will send four hours before the end of the day (in each user's timezone).
* For **weekly streaks**, it will send on Friday morning.
* For **monthly streaks**, it will send on the 25th of the month.

<Frame>
  <img height="200" width="50%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/streak_emails.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=05467c1a924262a56f221cb364c8355a" data-path="assets/features/emails/streak_emails.png" />
</Frame>

<h4 id="achievement-emails">
  Achievement Emails
</h4>

**Achievement** emails congratulate users when they complete an [achievement](/features/achievements) you've configured in Trophy. These emails send between 5-9PM on the day the achievement is completed, or the next day at 5PM if it is past 9PM when the user completes the achievement.

<Frame>
  <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/achievement_emails.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=929cdcfba043fec3ee2e5b33306090bf" data-path="assets/features/emails/achievement_emails.png" />
</Frame>

<h4 id="limiting-emails-to-specific-types-of-users">
  Limiting Emails to Specific Types of Users
</h4>

Each email template can be limited to users with specific [custom user attribute](/features/users#custom-user-attributes) values.

For each attribute you'd like to restrict the email to, click the plus icon next to the **User Filters** header for the email template, then select the attribute and enter the desired value. Only users that have **all** specified attribute values will receive emails from this template.

<Frame>
  <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/user_filters.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=2f14d26e6ce06a4522cdf2d6352b649d" data-path="assets/features/emails/user_filters.png" />
</Frame>

<h4 id="time-zones">
  Time Zones
</h4>

If you specify a timezone for each user through [User Identification](/features/users#param-tz), Trophy will use that local time zone to schedule emails according to the logic specified above. If you do not provide time zones for the users you identify, Trophy will default to Eastern Time.

<h2 id="designing-emails">
  Designing Emails
</h2>

Trophy has a fully-featured block-based email builder that allows you to design templates, controlling all email copy and subject lines. On the [emails](https://app.trophy.so/emails/configure) page, add templates under each [email type](#email-triggers) section you want to use.

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-15/4" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/designing_emails.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=8caa6b5167fedc097386c736175ea10e" data-path="assets/features/emails/designing_emails.mp4" />
</Frame>

<h3 id="default-templates">
  Default Templates
</h3>

By default, Trophy provides a template for each [email type](#types-of-emails) as a good starting point. The default templates can't be changed, but you can duplicate and customize these as you wish.

<Tip>
  You can also create blank templates if you just want to start from scratch.
</Tip>

<h3 id="creating-a-new-template">
  Creating A New Template
</h3>

To create a new email template, follow the steps below.

<Steps>
  <Step title="Head to the Emails page">
    Within the Emails page, you'll find the
    [Configure](https://app.trophy.so/emails/configure) tab, where each email type section contains its templates.
  </Step>

  <Step title="Add a template">
    Click the *Add Template* button within the section for the email type you want to create a template for.

    <Frame>
      <img height="200" width="100%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/choose_template.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=c4531f5f2645692762fc004194df0d18" data-path="assets/features/emails/choose_template.png" />
    </Frame>
  </Step>

  <Step title="Design your new template">
    Use the block-based editor to design your email template.

    <Frame>
      <video autoPlay muted loop playsInline className="w-full aspect-15/4" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/designing_emails.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=8caa6b5167fedc097386c736175ea10e" data-path="assets/features/emails/designing_emails.mp4" />
    </Frame>
  </Step>
</Steps>

<h3 id="block-types">
  Block Types
</h3>

Trophy's email builder supports a number of different block types that serve different purposes. All the basic components you'd expect to find in an email editor like paragraphs, headers, and images are called [Basic Blocks](#basic-blocks). There is also a set of more powerful components like charts and streaks that leverage Trophy's user activity data and gamification features. These are called [Smart Blocks](#smart-blocks).

<Frame>
  <img height="200" width="100%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/block_types_dialog.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=b00cf1235b650f2a7e0b4a7b6265e1fa" data-path="assets/features/emails/block_types_dialog.png" />
</Frame>

<h4 id="basic-blocks">
  Basic Blocks
</h4>

Here's the full list of un-opinionated basic blocks that Trophy supports:

* **Paragraph** - Good for short or longer text snippets.
* **H1, H2, H3** - Useful for headings of varying sizes.
* **Button** - Creates a call to action for users to take in emails.
* **Card** - Can nest other blocks, focusing attention.
* **Divider** - Good for separating content into logical sections.
* **Emoji** - Include any supported emoji, controlling size.
* **Image** - Upload any image and Trophy will render it in emails.
* **Spacer** - Good for giving blocks room to stand out.
* **Columns** - Useful for creating up to 3-column layouts with any content.
* **Logo** - Will render your organization's logo, set on the [Branding](https://app.trophy.so/branding) page.

<h4 id="conditional-blocks">
  Conditional Blocks
</h4>

Trophy also has a powerful conditional rendering system powered by the *Conditional* block type.

By nesting any other block inside a conditional block and setting up the conditions logic, you can create almost any email design that will show different blocks in emails based on the evaluation of conditions at send time.

If you're familiar with the `if/else` logical operators then this will feel very familiar to you. Otherwise here's a quick diagram to explain how it works.

```mermaid theme={null}
flowchart LR
    B@{ shape: diamond, label: "First condition true?" }
    C@{ shape: rounded, label: "Show first block" }
    D@{ shape: diamond, label: "Second condition true?" }
    E@{ shape: rounded, label: "Show second block" }
    F@{ shape: rounded, label: "Show default block" }

    B-- Yes --->C
    B-- No --->D
    D-- Yes --->E
    D-- No --->F
```

One common use case for the conditional block is to conditionally show a user their streak (one of Trophy's built-in [Smart Blocks](#smart-blocks)) and some streak-related motivational text only if they have an active streak. If the recipient isn't on a streak at the time the email is sent, then a simple message is displayed instead.

<Frame>
  <img height="100" width="50%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/conditional_block.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=6d1e343f0637694da38458d569e1ce7e" data-path="assets/features/emails/conditional_block.png" />
</Frame>

This creates a powerful framework to design emails based on highly relevant and personalized user data and can be used to create a wide-range of emails for common gamification use cases.

<h4 id="smart-blocks">
  Smart Blocks
</h4>

Smart blocks are powerful components designed to support common gamification use cases and integrate with all of Trophy's features including metrics, achievements and streaks.

You can find all smart blocks in the *Recommended Blocks* section, and they are always recognizable by the <Icon icon="zap" /> icon.

Watch Charlie walk through smart blocks and how they work:

<Frame>
  <iframe width="560" height="315" src="https://www.youtube.com/embed/CA7i8Gd5K1s?si=mHkAwVPZYMoBPm15" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
</Frame>

Read more about the use case of each smart block:

<AccordionGroup>
  <Accordion title="Achievement Progress Chart" icon="zap">
    The achievement progress chart block displays a chart with bars for up to five achievements for a particular metric, highlighting any that the recipient has unlocked.

    Choose the metric to display achievements for using the metric selector.

    <Frame>
      <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/achievement_progress_block.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=3dea8130e3c34c819638420e93fac7b8" data-path="assets/features/emails/achievement_progress_block.mp4" />
    </Frame>
  </Accordion>

  {" "}

  <Accordion title="Achievements Unlocked" icon="zap">
    The achievements unlocked block displays the achievement the recipient has unlocked. This is only useful in the context of achievement unlocked emails. If the recipient hasn't unlocked any achievements, then this block won't show in emails.

    Where achievements have badges, these will be automatically shown, as well as the name of the achievement.

    <Frame>
      <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/achievements_unlocked_block.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=c6cf7d0f541558f2774f29c0f12f5698" data-path="assets/features/emails/achievements_unlocked_block.mp4" />
    </Frame>
  </Accordion>

  {" "}

  <Accordion title="Progress Chart" icon="zap">
    The progress chart block shows the recipient's progress against a particular metric over the last 3 [aggregation periods](#aggregation-period).

    <Frame>
      <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/progress_chart_block.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=3e45783ebeccbabd252fa428a3f23768" data-path="assets/features/emails/progress_chart_block.mp4" />
    </Frame>
  </Accordion>

  <Accordion title="Streak" icon="zap">
    The streak block displays the recipient's current streak according to your account's streak settings.

    For daily streaks, a calendar block is shown displaying the last month's streak history. Weekly and monthly streaks display the last 7 periods of streak history.

    <Frame>
      <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/streak_block.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=d01a7d7357ab051d4564542aff0c011c" data-path="assets/features/emails/streak_block.mp4" />
    </Frame>
  </Accordion>
</AccordionGroup>

<h3 id="email-variables">
  Email Variables
</h3>

Trophy provides an expansive set of email variables that can be used to insert highly relevant and personalized copy into the body of emails and subject lines.

Variables bring context from your Trophy account, the recipient's progress data, and email specific settings to your email templates.

Email variables can be inserted by typing `@` in any block that supports rich text, like headers, paragraphs, and buttons, and searching for your chosen variable.

This will open up the variable editor window where you can configure variables as in the demo below.

<Tip>You can also use variables in email subject lines.</Tip>

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/email_variables_demo.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=a965e69abb155b19d53c8b0d27f26e08" data-path="assets/features/emails/email_variables_demo.mp4" />
</Frame>

See below for a full list of all email variables supported by the email builder, broken down by category.

<AccordionGroup>
  <Accordion title="User">
    Variables related to the recipient of the email.

    * **Name**: The recipient's name, if set

    Additionally all [custom user attributes](/features/users#custom-user-attributes) are available as email variables.
  </Accordion>

  <Accordion title="Metrics">
    Variables related to the recipients tracked event data against metrics.

    Each Trophy metric supports the following email variables:

    * **Metric Name**: The name of the metric
    * **Metric Units**: The metric's units
    * **Current Total**: The sum of all the recipients event values to date
    * **Change This Period**: Absolute change in the recipients current total in the current aggregation period
    * **Change This Period (%)**: Percent change in the recipients current total in the current aggregation period
    * **Percentile (All Time)**: The recipients current total compared to all other users for all time
    * **Percentile (This Period)**: The recipients current total compared to all other users in the current aggregation period

    Additionally, the **Highest** and **Lowest** dynamic aliases support the same set of variables. When using these aliases, Trophy will pick the metric where the recipient has either the highest or lowest current total at send time.

    When using metric variables, you also have the option of filtering the data that any of the above variables reference through a [custom event attribute](/features/events#custom-event-attributes).
  </Accordion>

  <Accordion title="Points">
    Similarly to metrics, each points system has the following variables that can be used to add dynamic data to email copy:

    * **Current Total**: The recipients total points
    * **Change This Period**: Absolute change in the recipients total points in the current aggregation period
    * **Change This Period (%)**: Percent change in the recipients total points in the current aggregation period
    * **Percentile (All Time)**: The recipients total points compared to all other users for all time
    * **Percentile (This Period)**: The recipients total points compared to all other users in the current aggregation period

    .
  </Accordion>

  <Accordion title="Achievements">
    <Note>
      These variables are only relevant for [achievement emails](#achievement-emails).
    </Note>

    When configuring a template for use with achievement emails, the following variables are available:

    * **Is Final Achievement**: If the achievement triggering the email is part of a series of metric achievements, this is true when the achievement is the final achievement in the series
    * **Percent To Next Achievement**: If the achievement triggering the email is part of a series of metric achievements, this is the percentage until the user unlocks the next achievement in the series
    * **Achievement Name**: The name of the achievement that triggered the email
    * **Achievement Description**: The description of the achievement that triggered the email

    .
  </Accordion>

  <Accordion title="Streak">
    Variables related to the recipient's streak.

    * **Has Active Streak**: True if the recipient has an active streak at the time the email is sent, false otherwise
    * **Streak Length**: The length of the recipient's current streak
    * **Streak Extended**: True if the recipient's streak was extended, false otherwise
    * **Days Since Last Extended**: The number of days since the user last extended their streak

    .
  </Accordion>

  <Accordion title="Reactivation">
    <Note>
      These variables are only relevant for [reactivation emails](#reactivation-emails).
    </Note>

    * **Message Number**: The number of the message in the reactivation sequence (1-5)

    .
  </Accordion>

  <Accordion id="aggregation-period" title="Aggregation Period">
    <Note>
      These variables are only relevant for [recap emails](#recap-emails).
    </Note>

    * **Current Period Date Range**: The start and end dates of the current aggregation period

    .
  </Accordion>
</AccordionGroup>

<h4 id="advanced-usage">
  Advanced Usage
</h4>

There are a couple of additional options to consider when using emails variables.

**Prefix & Suffix**

You can provide a prefix and suffix for text variables like the recipients name, or the name of a particular metric.

<Frame>
  <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/advanced_variables_prefix_suffix.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=0bbe57d9597ab72275528226153ab51e" data-path="assets/features/emails/advanced_variables_prefix_suffix.png" />
</Frame>

If the value of the variable fails to render when the email is sent, then Trophy won't display the variable or the prefix or suffix to keep emails clean.

**Singular & Plural**

When using numeric variables like the recipients current points total or metric total, you can also provide a singular and plural suffix to accompany it.

<Frame>
  <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/advanced_usage_singular_plural.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=bee26a91372d03856f1dd691e204ab32" data-path="assets/features/emails/advanced_usage_singular_plural.png" />
</Frame>

<h3 id="text-variations">
  Text Variations
</h3>

Variations can be used to add randomness to text within emails sent by Trophy. This prevents emails from getting boring and helps improve open and click rates.

<Frame>
  <iframe width="560" height="315" src="https://www.youtube.com/embed/mlxMqHsdql8?si=hhizWfwiylgxxEuV" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
</Frame>

Any block that supports text entry including H1, H2, H3 and paragraph support variations.

<Tip>You can also use variations to add randomness to email subject lines.</Tip>

To create a variation click the *Add Variation* button on any block that supports them.

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/creating_variations.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=948da1b74f66e9353be2eb3d3865fb87" data-path="assets/features/emails/creating_variations.mp4" />
</Frame>

<Note>
  Variations do not support A/B testing yet, but this is on our roadmap so stay
  tuned...
</Note>

<h3 id="using-the-editor">
  Using The Editor
</h3>

The email template editor is a blank canvas for designing emails that look great in the inbox. Using pre-configured [Blocks](#block-types) makes it really easy to create email templates that suit common gamification use cases. Here we'll walk through how to best use the editor to create awesome looking emails.

<h4 id="adding-blocks">
  Adding Blocks
</h4>

To add a new block an email template hit the <Icon icon="square-slash" /> key, this will open the block selection dialog where you can choose the block you want to add.

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/add_new_block_slash.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=8ebf24817b429c4521a54dfbc98779ae" data-path="assets/features/emails/add_new_block_slash.mp4" />
</Frame>

Or if you want to add a block immediately after another block, use the block menu.

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/add_new_block_by_block_menu.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=cff7608ea8ad4c9472e2dbc858b9e15f" data-path="assets/features/emails/add_new_block_by_block_menu.mp4" />
</Frame>

<h4 id="arranging-blocks">
  Arranging Blocks
</h4>

Blocks can be dragged up and down using the block menu.

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/arranging_blocks.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=076bd139a846a5eba54d76cda6e47a0e" data-path="assets/features/emails/arranging_blocks.mp4" />
</Frame>

<h4 id="text-formatting">
  Text Formatting
</h4>

The email editor offers rich text formatting including bold, italics, [hyperlinks](https://www.youtube.com/watch?v=dQw4w9WgXcQ) and `code` formatting.

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/rich_text_formatting.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=44acc0bd50df33c9881b7afb55e57c2f" data-path="assets/features/emails/rich_text_formatting.mp4" />
</Frame>

<h3 id="font-style">
  Font Style
</h3>

On the [email configure page](https://app.trophy.so/emails/configure), you'll find a setting to change the font style used in all emails.

<Frame>
  <img height="200" width="75%" noZoom src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/aggregation_period_setting.png?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=75a65753bded85339f29597db9a0bf27" data-path="assets/features/emails/aggregation_period_setting.png" />
</Frame>

Other email styles are pulled from your Trophy account's [Branding](https://app.trophy.so/branding) settings.

<h2 id="handling-unsubscribes">
  Handling Unsubscribes
</h2>

All emails that Trophy sends include an unsubscribe link and message. This is important for maintaining compliance with regulations and it's not possible to hide it.

<Info>
  The message will read as follows: You are receiving this email because you
  are subscribed to progress report and achievement emails. If you no longer
  wish to receive these emails, you can unsubscribe.
</Info>

Any recipient that clicks this link will be taken to a branded page that allows them to control which emails notifications they receive.

<Tip>
  As an alternative to the unsubscribe link, you can also build a preference
  center in your application using Trophy's [user preferences
  API](/features/users#notification-preferences). This gives users more granular
  control over which types of emails they receive.
</Tip>

<h2 id="email-analytics">
  Email Analytics
</h2>

Trophy has built-in analytics for all Emails that it sends. This includes:

* Recipients (The total number of people that received the email)
* Open rate (The percentage of recipients that opened the email)
* Click rate (The percentage of recipients that clicked on at least one link in the email)
* Retention rate (The percentage of users that opened the email that came back and used your platform after at least 2 days)

<Frame>
  <video autoPlay muted loop playsInline className="w-full aspect-video" src="https://mintcdn.com/trophy/rGjOHIeZYrVU9hOo/assets/features/emails/email_analytics.mp4?fit=max&auto=format&n=rGjOHIeZYrVU9hOo&q=85&s=c62ac05c1c2140958aaea06dae30c364" data-path="assets/features/emails/email_analytics.mp4" />
</Frame>

<h2 id="frequently-asked-questions">
  Frequently Asked Questions
</h2>

<AccordionGroup>
  <Accordion title="Can I send emails from my own domain?">
    Yes! Sending emails from your own domain is supported out-of-the-box. Follow the steps in the section on [sending emails](#sending-emails) to get started.
  </Accordion>

  {" "}

  <Accordion title="Do you limit how many emails I can send?">
    No, we don't limit how many emails you can send. However, we do monitor usage
    to prevent abuse.
  </Accordion>
</AccordionGroup>

<h2 id="get-support">
  Get Support
</h2>

Want to get in touch with the Trophy team? Reach out to us via [email](mailto:support@trophy.so). We're here to help!
