---
layout: article
title: Message templates
description: Communicate using your brand and voice by customizing email and SMS message templates, localized to your user's language.
---

Appwrite uses emails to communicate with users to perform authentication and verification actions. Emails can be customized to fit your app's design and voice.

Each Appwrite project can have its own set of unique templates. Templates also support localization, so every template can be written in multiple languages and served depending on the configured locale.

# Custom SMTP server

Appwrite Cloud has a default SMTP server to get you started. This SMTP server sends generic emails and doesn't allow customizing SMTP templates. To use custom SMTP templates, you will need to configure your own SMTP server.

Custom SMTP is available on Appwrite Cloud Pro and higher plans. You can connect a supported provider in one click, or enter the settings from any SMTP provider by hand.

## One-click setup with Resend

On Appwrite Cloud, the **SMTP** tab starts with a **One-click setup** card. Connect a [Resend](https://resend.com) account and Appwrite creates a sending-only API key for one of your verified domains, then fills in and enables the custom SMTP settings for you.

![One-click setup card on the SMTP tab](/images/docs/auth/smtp/one-click-setup.avif)

1. Navigate to your project's **Settings**.
1. Navigate to the **SMTP** tab.
1. Under **One-click setup**, click **Connect with Resend**.
1. Authorize Appwrite in Resend. You are returned to the same tab, and the Resend tile now shows **Connected**.
1. Select a verified **Domain**. Domains that are not yet verified in Resend are listed but can't be selected.
1. Enter a **Sender name** and a **Sender email** on the selected domain. Appwrite suggests `noreply@<domain>`.
1. Click **Set up**.

![Set up SMTP with Resend](/images/docs/auth/smtp/one-click-setup-resend.avif)

Appwrite creates an API key in your Resend account named `Appwrite SMTP: <project name>`. The key has sending-only permission and is restricted to the selected domain. Appwrite stores it as the SMTP password and writes the rest of the settings for you.

| Setting | Value |
| --- | --- |
| Server host | `smtp.resend.com` |
| Server port | `587` |
| Username | `resend` |
| Secure protocol | TLS |
| Password | The sending-only API key Appwrite created |

Custom SMTP is enabled as soon as the setup completes. Your existing reply-to email is kept. If you don't have a verified domain yet, add one in [Resend's domains page](https://resend.com/domains) and click **Check again**.

The connection lives on your Console account, not the project, so it shows as **Connected** in every project you open. Resend issues a short-lived access token that Appwrite stores on the linked identity of your Console account, and Appwrite asks you to **Reconnect** when it expires. To remove the connection, open the tile's menu and click **Disconnect**. Disconnecting removes the Resend identity from your Console account and doesn't change the SMTP settings already saved on your projects or revoke keys already in use.

Mailgun and SendGrid tiles appear as **Coming soon**. Click **Notify me** on either to be told when it ships.

## Configure SMTP manually

There are many third-party SMTP providers like SendGrid and Mailgun. Before proceeding, pick an SMTP provider, create an account, and obtain **Sender name**, **Sender email**, **Server host**, **Server port**, **Username**, and **Password**.

1. Navigate to your project's **Settings**.
1. Navigate to the **SMTP** tab.
1. Under **SMTP server**, toggle **Custom SMTP server**.
1. Input **Sender name**, **Sender email**, **Server host**, **Server port**, **Username**, and **Password** from your provider.
1. Click **Update**.

# Customize templates

You can customize email templates for each of your projects in the Appwrite Console.

**Custom SMTP server required**

The built-in email service does not support custom email templates to prevent malicious templates.
Configure a [custom SMTP server](#smtp) to enable custom email templates.

1. In your project, navigate to the **Auth** service.
1. Under the **Auth** service, navigate to the **Templates** tab.
1. Expand the email template you want to edit.
1. Select the **Template language**. You can have a different template for each language your app supports.
1. Update the email template fields and click **Update** to save your changes.

# Email templates

You can customize the email templates for account verification, magic-url authentication, password resets, and user invites.

## Email template components

Each email template has the following components that you can customize.

| Component | Description |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Sender name | Readers will see this as a display name of the sender. |
| Sender email | Readers will see this as a display email of the sender. This email must be authenticated on the SMTP provider you've configured, otherwise it will be delivered to the spam folder. This usually means the email must end with the same domain as your SMTP username. |
| Reply to | Readers will reply to this email address instead of the sender address. You can leave this field empty, and the sender email will be used automatically. |
| Subject | The title of the email. |
| Message | The body of the email in HTML format. You can find the variables available in the [Email Template Syntax](#email-template-syntax) section. |

## Email template syntax

Variables can be used in email templates to dynamically construct unique emails for each reader. These variables can only be used in the **Message** field of the email template.

| Variable | Description |
| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `{{project}}` | The project name. |
| `{{team}}` | The project team's name. |
| `{{user}}` | The name of the user receiving the email. This variable is not available in the Magic URL template, as there might not be a user yet. |
| `{{redirect}}` | The URL for the user to complete the email template's action. |

## Email template examples

Here's an example of using these variables in a template.

```html
<!doctype html>
<html>

<head>
    <!-- <style>
        ... your style here
    </style> -->
</head>

<body style="direction: ltr">

    <div style="max-width:650px; word-wrap: break-word; overflow-wrap: break-word;
  word-break: break-all; margin:0 auto;">
        <table style="margin-top: 32px">
            <tr>
                <td>
                    <h1>{{subject}}</h1>
                </td>
            </tr>
        </table>

        <table style="margin-top: 40px">
            <tr>
                <td>
                    <p>Hello </p>

                    <p>Follow this link to reset your {{project}} password.</p>

                    <a href="{{redirect}}" target="_blank" rel="noopener noreferrer">{{redirect}}</a>

                    <p><br />If you didn't ask to reset your password, you can ignore this message.</p>
                    <br />

                    <p>Thanks
                        <br />
                        {{project}} team</p>
                </td>
            </tr>
        </table>
    </div>

</body>

</html>
```

# Localization

Each template can have multiple supported locales, displayed in different format and language. This can be configured under the **Template language** selector of each template.

You can send messages in different languages by setting the locale with `client.setLocale()` in the SDKs or the `X-Appwrite-Locale` HTTP header. [View here the list of available locales](https://github.com/appwrite/appwrite/blob/master/app/config/locale/codes.php).

For example, you can send an email verification in French.

```client-web
import { Client, Account } from "appwrite";

const client = new Client();

const account = new Account(client);

client
    .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
    .setProject('<PROJECT_ID>')                 // Your project ID
    .setLocale('fr')                             // Your locale
;

const promise = account.createVerification({
    url: 'https://example.com'
});

promise.then(function (response) {
    console.log(response); // Success
}, function (error) {
    console.log(error); // Failure
});
```

```client-flutter
import 'package:appwrite/appwrite.dart';

void main() { // Init SDK
  Client client = Client();
  Account account = Account(client);

  client
    .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
    .setProject('<PROJECT_ID>')                 // Your project ID
    .setLocale('fr')                             // Your locale
  ;
  Future result = account.createVerification('https://example.com');

  result
    .then((response) {
      print(response);
    }).catchError((error) {
      print(error.response);
  });
}
```

```client-android-kotlin
import io.appwrite.Client
import io.appwrite.services.Account

val client = Client(context)
    .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
    .setProject("<PROJECT_ID>")                 // Your project ID
    .setLocale('fr')                             // Your locale

val account = Account(client)

val response = account.createVerification('https://example.com')
```

```client-apple
import Appwrite

let client = Client()
    .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
    .setProject("<PROJECT_ID>")                 // Your project ID
    .setLocale('fr')                             // Your locale

let account = Account(client)

let token = try await account.createVerification('https://example.com')
```
