
An email is a great way to present a tailored offer to your customers. You can prepare a recommendation of items which match the preferences of each customer and distribute this offer by using emails.

This use case describes how to create such a recommendation and contains instructions on preparing an email template that contains the recommendation.

## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration).
- Import a product feed to Synerise.
- Implement OG tags, required: `product:retailer_part_no` (which is the same as `<g:id>` in the product feed).
- [Configure an item feed for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) - initiate the personalized model training.

## Process 
---
In this use case, you will go through the following steps:
1. [Create AI recommendation](/use-cases/personalized-email-with-brands#create-ai-recommendation).
2. [Prepare an email template](/use-cases/personalized-email-with-brands#prepare-an-email-template).

## Create AI recommendation
---
In this part of the process, you create a recommendation that will display items of a different brand per slot. The selection of items will be adjusted to the preferences of an individual customer. 

1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/ai-hub-icon.svg" alt="AI Hub icon" class="icon" > **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section, click **Define**.
1. From the **Items feed** dropdown list, select a product feed for which the model training is completed.   
    
   <div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

   You can learn more about the statuses of the model training [here](/docs/settings/configuration/ai-engine-configuration/model-status).

   </div></div></div>

2. Select the **Personalized** recommendation type.  
    <figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/personalized-email-brands-type.png" class="full" alt="Configuraion of the catalog and recommendation type section"><figcaption>Configuraion of the catalog and recommendation type section</figcaption></figure>
3. Confirm by clicking **Apply**. 
7. In the **Items** section, click **Define**.  
    1. Click **Add slot**.  
    2. Click the slot you added. Optionally, you can rename it.  
    3. Define the minimum and the maximum number of products displayed in the slot according to your needs.  
        
       <div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

       Learn more about the [recommendation settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#configure-item-slots).

       </div></div></div>

    4. In **Static filters**, set the following parameters:  
        - `availability` to `true` - it shows only available products,
        -  `brand` to a brand of your choice, for example, `brand equals Acme`.
        <figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/personalized-email-brands-items.png" class="full" alt="Configuraion of the filters"><figcaption>Configuraion of the filters</figcaption></figure>
    5. Click **Add slot** and repeat steps b-d. In step d, select different brands.  
        <figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/personalized-email-brand-slots.png" class="full" alt="Configuraion of the items section"><figcaption>Final configuraion of the items section</figcaption></figure>
    6. Confirm by clicking **Apply**.  
6. Optionally, you can define the settings in the **Boosting** and **Additional settings** sections.  
    
   <div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

   Learn more about [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors) and [additional settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#additional-settings)

   </div></div></div>
   
7. Save the recommendation by clicking the **Save** button in the upper right corner.

## Prepare an email template
---
In this part of the process, you create an email template that contains a Jinjava code that contains the recommendation you created in the previous step. Before you start reating a template, obtain the ID of the recommendation you created in the previous part of the process (in the URL of the recommendation).  

1. Go to **Experience Hub > Email**.  
2. On the right side, click **Templates**.
3. Select the **Code editor**.  
4. Enter the name of the template.
4. In the HTML section, paste the following Jinjava code.  
    
   <pre><code class="language-jinja">{% recommendations3 campaignId=insert_recommendation_ID %}
       {% for slot_products in slots_products3 %} 
           {% for item in slot_products.items %} 
               {{ item.itemId }}
           {% endfor %}
       {% endfor %}
   {% endrecommendations3 %}</code></pre>

5. Replace `insert_recommendation_ID` with the ID of your recommendation. You can find the ID in the URL of the recommendation.  
6. Adjust the content and design of your message using CSS.
8. Click **Save this template > Save as**. 
9. Select the template folder in which the template will be saved.  
10. Confirm by clicking **Apply**.  

## What's next
---
You can use such template in an email campaign which you can send manually or you can prepare a workflow in **Automation Hub** and use it as a part of your business scenario. 

## Read more
---
- [Email campaigns](/docs/campaign/e-mail)
- [Recommendations](/docs/ai-hub/recommendations-v2)