> For the complete documentation index, see [llms.txt](https://docs.b2copy.b2broker.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.b2copy.b2broker.com/admin-guide/configure-b2copy/use-email-templates-to-notify-clients-about-important-events.md).

# Use email templates to notify clients about important events

In the Back Office, you can manage predefined email templates that are used to notify clients about important events, such as creating new master and investment accounts or subscribing and unsubscribing to/from master accounts.

To view a full list of predefined email templates, go to **System** > **Templates** > **Email** > **Templates**.

The following is a list of email templates used for email notifications specific to the B2COPY investment platform:

<table data-full-width="true"><thead><tr><th width="377">Template type name</th><th>Description</th></tr></thead><tbody><tr><td><strong>New copy-trading accounts</strong></td><td></td></tr><tr><td><code>InvestmentMasterAccountCreated</code></td><td>Used to notify a client about a newly created copy-trading master account and provide the account details</td></tr><tr><td><code>InvestmentInvestorAccountCreated</code></td><td>Used to notify a client about a newly created copy-trading investment account and provide the account details</td></tr><tr><td><strong>New MAM accounts</strong></td><td></td></tr><tr><td><code>MamMasterAccountCreated</code></td><td>Used to notify a client about a newly created MAM master account and provide the account details</td></tr><tr><td><code>MamInvestorAccountCreated</code></td><td>Used to notify a client about a newly created MAM investment account and provide the account details</td></tr><tr><td><strong>New PAMM accounts</strong></td><td></td></tr><tr><td><code>PammMasterAccountCreated</code></td><td>Used to notify a client about a newly created PAMM master account and provide the account details</td></tr><tr><td><code>PammInvestorAccountCreated</code></td><td>Used to notify a client about a newly created PAMM investment account</td></tr><tr><td><strong>New subscriptions (used for all copy-trading, MAM, and PAMM subscriptions)</strong></td><td></td></tr><tr><td><code>InvestmentNewSubscriber</code></td><td>Used to notify a master account owner about a new subscription to their master account and provide subscription details</td></tr><tr><td><code>InvestmentNewSubscription</code></td><td>Used to notify an investor about their new subscription to a master account and provide subscription details</td></tr><tr><td><code>InvestmentCloseSubscription</code></td><td>Used to notify an investor about their unsubscription from a master account</td></tr><tr><td><strong>Other</strong></td><td></td></tr><tr><td><code>accountPassword</code></td><td>Sent to a client after the client clicks the <strong>Reset password</strong> button on the <a href="https://github.com/b2broker-gitbook/gitbook-b2copy/blob/master/user-guide/manage-master-and-investment-accounts/view-your-account-details/settings-page.md">Settings page</a> in the Web UI in order to change the password for their trading account, and then selects the <strong>Random method setup</strong>. In this case, the email notification includes a newly generated password.</td></tr></tbody></table>

## Manage email templates

You can disable or enable email templates, change the subjects of email notifications, and edit the HTML and Twig code that forms the email body.

{% hint style="warning" %}
Making substantial changes to predefined email templates requires a good understanding of HTML and Twig. If you're not familiar with these instruments, it's recommended to make only minor edits, such as changing the text color or company name.
{% endhint %}

Modify a selected email template as follows:

{% stepper %}
{% step %}
On the **Email template** page, click the **Edit** button located in the template row\.The **Edit email template** page opens.

<figure><img src="/files/8wIoeuiS5c0sIwxlKLe4" alt="Edit email template"><figcaption><p>Edit email template</p></figcaption></figure>
{% endstep %}

{% step %}
To disable the email template, select **No** in the **Enabled** dropdown. If the template is disabled, notifications about the related event aren’t sent to clients.

To enable the email template, select **Yes** in the **Enabled** dropdown.
{% endstep %}

{% step %}
To change the email subject, update the text displayed in the **Subject** field. The email subject typically includes your company name followed by the specific subject of the email notification.

`{{ keyvalue('mail_subject_company') }} | Master Account Created`

The company name is stored in a key-value pair. In this case, the key “mail\_subject\_company” is assigned a string containing your company name. During email rendering, the key is replaced with your company name. For a list of key-value pairs supported for email templates and details on how to assign values to keys refer to **Set key-value pairs** below.
{% endstep %}

{% step %}
In the **Email Template** field, you can view the email body coded in HTML and Twig. The **Preview** field displays how the code will be rendered in emails.

{% hint style="info" %}
The preview may not show all possible template variants because a template may include variables that are substituted with actual values during email rendering. For example, the following Twig code substitutes a client's name into an email notification:
{% endhint %}

```
{% raw %}
{% if entity.info.givenName != "" %}
    Dear {{ entity.info.givenName }},

{% else %}
    Dear client!

{% endif %}
{% endraw %}
```

If the name is specified in a client profile, it is substituted into the email notification; otherwise, “Dear client!” is used instead of the client’s name.

In addition to substitutional variables, the email body may contain keys that are replaced with values that are stored in the key-value storage (for details, refer to **Set key-value pairs** below).
{% endstep %}

{% step %}
Click **Save** to apply the changes made to the email template.
{% endstep %}
{% endstepper %}

## Set key-value pairs

Email templates for client notifications contain keys that are replaced with the values assigned to them. These key-value pairs are stored in the key-value storage. You can modify the values assigned to keys as follows:

{% stepper %}
{% step %}
Go to **System** > **Key storage** > **Key storage values**.

The following are some keys commonly used in email notifications. You can change the values assigned to these keys.

* **mail\_subject\_company** – the name of your company displayed in the subjects of email notifications
* **mail\_company\_name** – the name of your company displayed in the text of email notifications
* **mail\_support\_email** – the email address of the Support team in the text of email notifications
* **mail\_logo\_url** – the URL of an image that is included as a company logo in email notifications
* **mail\_logo\_height** – the logo height, in pixels
* **mail\_logo\_width** – the logo width, in pixels
* **mail\_text\_color** – the text color used in email notifications
* **mail\_content\_bg** – the background color applied to content blocks in email notifications
* ‍**mail\_body\_bg** – the background color applied to email notifications
  {% endstep %}

{% step %}
Select a key and click the **Edit** button located in the key row.
{% endstep %}

{% step %}
In the **Value** field, enter a new value that you want to assign to the selected key.

<figure><img src="/files/RgAP9Ygb9rJ1QzAuLb7Y" alt="Set a key-value pair"><figcaption><p>Set a key-value pair</p></figcaption></figure>
{% endstep %}

{% step %}
Click **Save** to apply the changes.
{% endstep %}
{% endstepper %}

## View a list of sent email notifications

To view a list of email notifications sent to your clients, go to **Mailing** > **System** > **Log**.

<figure><img src="/files/nGuWaNgywM3yqRpfEtQr" alt="The log of sent email notifications"><figcaption></figcaption></figure>

On the **Mailing** **Log** page, you can view a list of email notifications sent to clients and view the following information:

**ID**\
**‍**The email identifier in the system.

**Active queue ID**\
**‍**The identifier of the queue in which the email is included.

**Email**\
**‍**The client email address.

**Subject**\
**‍**The email subject.

**Attempt date**\
**‍**The date and time of the last attempt to send the email.

**Status**\
**‍**The email delivery status:

* IN PROGRESS
* FAIL
* SUCCESS

**Reason**\
**‍**The reason why the email delivery failed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.b2copy.b2broker.com/admin-guide/configure-b2copy/use-email-templates-to-notify-clients-about-important-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
