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

# メールテンプレートでサポートされる Liquid 構文

> メールテンプレートでサポートされる Liquid タグ、フィルター、一般的な変数の一覧です。

Liquid 構文の概要については、[LiquidJS introduction](https://liquidjs.com/tutorials/intro-to-liquid.html)をご覧ください。ここでは、Liquid の 2 種類のマークアップについて簡潔に説明されています。

* **出力**。HTML を出力します。

  出力の構文は、変数または値と、必要に応じたフィルターのリストを `{{` と `}}` で囲んだものです。たとえば、`{{ user.name }}` です。

* **タグ**。テンプレートのレンダリングを制御し、ロジックを実装します。

  タグの構文は、タグ名と必要に応じた引数を `{%` と `%}` で囲んだものです。たとえば、`{% if user_metadata.lang == 'it' %} Ciao! {% endif %}` です。

このページでは、メールテンプレートでサポートされるタグ、フィルター、変数を一覧で紹介します。

<div id="tags">
  ## タグ
</div>

すべてのメールテンプレートで、以下の Liquid タグを利用できます。

| カテゴリ  | タグ                                      |
| ----- | --------------------------------------- |
| 反復    | `for`, `cycle`, `tablerow`              |
| 制御フロー | `if`, `unless`, `elsif`, `else`, `case` |
| 変数    | `assign`, `increment`, `decrement`      |
| ファイル  | `include`, `layout`                     |
| 言語    | `raw`, `comment`                        |

Liquid タグの説明と使用例は、[LiquidJS のタグページ](https://liquidjs.com/tags/overview.html)で確認できます。

<div id="debug-tag">
  ### debug タグ
</div>

デバッグや開発に役立てるため、独自の `{% debug %}` タグは、テンプレートがレンダリングされた時点でそのテンプレート内で使用できるテンプレート変数の概要を出力します。

<div id="filters">
  ## フィルター
</div>

すべてのメールテンプレートで、以下の Liquid フィルターを利用できます。

| カテゴリー    | フィルター                                                                                                                                                                                              |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 算術       | `plus`, `minus`, `modulo`, `times`, `floor`, `ceil`, `round`, `divided_by`, `abs`, `at_least`, `at_most`                                                                                           |
| 文字列      | `append`, `prepend`, `capitalize`, `upcase`, `downcase`, `strip`, `lstrip`, `rstrip`, `strip_newlines`, `split`, `replace`, `replace_first`, `remove`, `remove_first`, `truncate`, `truncatewords` |
| HTML/URI | `escape`, `escape_once`, `url_encode`, `url_decode`, `strip_html`, `newline_to_br`                                                                                                                 |
| 配列       | `slice`, `map`, `sort`, `sort_natural`, `first`, `last`, `join`, `reverse`, `size`                                                                                                                 |
| 日付       | `date`                                                                                                                                                                                             |
| その他      | `default`                                                                                                                                                                                          |

Liquid フィルターの説明と例は、[LiquidJS のフィルターページ](https://liquidjs.com/filters/overview.html)で確認できます。

<div id="general-variables">
  ## 一般変数
</div>

以下の変数は、すべてのテンプレートの **From Address**、**Subject**、**Message** フィールドで使用できます (特に記載がない限り) 。

信頼できないプロパティをメールテンプレートで使用する場合は、`escape` フィルターでエスケープしてください (例: `{{ user.name | escape }}`) 。

* `application` オブジェクト。`application.name` や `application.client_metadata` など、標準的なクライアントプロパティにアクセスできます

* ユーザーの言語選択を表す `request_language`

* `connection.name`

<Warning>
  - MFA登録 email テンプレートでは、`connection.name` 変数は使用できません。
</Warning>

* [Tenant Settings](https://manage.auth0.com/#/tenant) で定義されるテナント関連の情報:
  * `tenant` (生のテナント名)
  * `friendly_name`
  * `support_email`
  * `support_url`

* 以下の `user` 変数:
  * `user.email`
  * `user.email_verified`
  * `user.picture` (**信頼できない**)
  * `user.nickname` (**信頼できない**)
  * `user.given_name` (**信頼できない**)
  * `user.family_name` (**信頼できない**)
  * `user.name` (**信頼できない**)
  * `user.app_metadata`。アプリケーションの動作や、ユーザーがアクセスできる対象など、ユーザーの中核的な機能に影響する可能性がある属性です。サポートプラン、セキュリティロール、アクセス制御グループなどが含まれます
  * `user.user_metadata` (ユーザー提供情報を含む場合は **信頼できない**) 。ユーザー設定など、ユーザーの中核的な機能には影響しない属性です

<Warning>
  Passwordless OTP メールテンプレートでは、`user` オブジェクトの `email` プロパティのみ使用できます。
</Warning>

* ユーザーが [組織](/docs/ja-jp/manage-users/organizations/organizations-overview) を通じてログインした場合は、次の追加変数も使用できます:
  * `organization.id`
  * `organization.display_name`
  * `organization.name`
  * `organization.metadata`
  * `organization.branding.logo_url`
  * `organization.branding.colors.primary`
  * `organization.branding.colors.page_background`

* 複数の <Tooltip tip="カスタムドメイン: 特別な名前、または独自名を持つサードパーティドメイン。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=custom+domains">カスタムドメイン</Tooltip> 変数:

  * `custom_domain.domain` (使用中のカスタムドメイン名。例: `login.example.com`)
  * `custom_domain.domain_metadata`。カスタムドメインのメタデータフィールド (キーと値のペア) で、ドメインに応じてメールの内容をカスタマイズするために使用できます

[複数のカスタムドメイン](/docs/ja-jp/customize/custom-domains/multiple-custom-domains) を使用している場合、Auth0 はメールリンクに適切なカスタムドメインを自動的に使用します。これらの変数を使うことで、どのカスタムドメインがメールの送信をトリガーしたかに応じて、メールの内容をカスタマイズできます。

**例**: カスタムドメインのメタデータに基づいてメールのブランディングをカスタマイズする:

```liquid theme={null}
{% if custom_domain.domain_metadata.brand == "BrandA" %}
  <h1 style="color: #0000FF;">Welcome to Brand A</h1>
{% elsif custom_domain.domain_metadata.brand == "BrandB" %}
  <h1 style="color: #FF0000;">Welcome to Brand B</h1>
{% else %}
  <h1>Welcome</h1>
{% endif %}
```

**例**: ドメイン固有のサポート情報を含める：

```liquid theme={null}
{% if custom_domain.domain_metadata.support_email %}
  <p>Need help? Contact us at {{ custom_domain.domain_metadata.support_email }}</p>
{% else %}
  <p>Need help? Contact us at {{ support_email }}</p>
{% endif %}
```

メールでカスタムドメインを使用するには、次のことを確認してください。

1. [カスタムドメイン](/docs/ja-jp/customize/custom-domains)の設定と検証が完了していること
2. **Auth0 Dashboard** > **Branding** > **カスタムドメイン** で **Use Custom Domain in Emails** を有効にしていること
3. 複数のカスタムドメインを使用している場合は、[デフォルトのカスタムドメイン](/docs/ja-jp/customize/custom-domains/multiple-custom-domains/default-domain)を設定していること

<div id="redirect-to-variables">
  ### Redirect To 変数
</div>

**Redirect To** URL フィールドがあるメールテンプレートでは、サポートされる変数は次の 3 つだけです。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  2026 年 5 月 5 日以降に作成された Enterprise 以外のテナントでは、カスタムの **Redirect To** 値は使用できません。[URL の有効期間と Redirect To](/docs/ja-jp/customize/email/email-templates/customize-email-templates#url-lifetime-and-redirect-to)を参照してください。
</Callout>

* `application.name` (またはその同義語の `client.name`)
* `application.clientID`
* `application.callback_domain` (またはその同義語の `client.callback_domain`) 。これには、アプリケーションの **Allowed Callback URL** リストの先頭にある URL のオリジンが含まれます。これはオリジンであるため、ドメインに加えてプロトコル (`https://` など) も含まれます。

  callback domain を使うと、`{{ application.callback_domain }}/result_page` のような構文で、そのアクションをトリガーしたアプリケーション内のパスにユーザーをリダイレクトできます。

<div id="template-specific-variables">
  ## テンプレート固有の変数
</div>

すべてのメールテンプレートで使用できる共通の Liquid 変数に加え、以下のメールテンプレートでは追加の変数も使用できます。

<div id="blocked-account-email-template-variables">
  ### アカウントがブロックされた際のメールテンプレート変数
</div>

* `user.source_ip`
* `user.city`
* `user.country`
* `url`、アカウントのブロック解除用リンク

<div id="change-password-code-email-template-variables">
  ### パスワード変更 (コード) メールテンプレートの変数
</div>

* `code`、パスワード変更用のコード

<div id="change-password-link-email-template-variables">
  ### パスワード変更 (リンク) メールテンプレートの変数
</div>

* `url`：パスワードリセット用のリンク

<div id="mfa-enrollment-email-template-variables">
  ### MFA登録メールテンプレートの変数
</div>

* `link`：MFA登録リンク。

<div id="passwordless-otp-email-template-variables">
  ### パスワードレス OTP メールテンプレート変数
</div>

* リクエストされたパスワードレスメールの種類に応じて、値が `link`、`link_ios`、`link_android`、または `code` になる `send`
* アプリケーションにアクセスするための使い捨てコードを表す `code`
* ユーザーがクリックしてアプリケーションにアクセスできるリンクを表す `link` (リンク型のパスワードレスメールの場合のみ)
* パスワードレスのメールアドレス変更操作では、値が `change_email` になる `operation`

<div id="user-invitation-email-template-variables">
  ### ユーザー招待メールテンプレートの変数
</div>

* `inviter.name`
* `roles.id`
* `roles.name`
* `roles.description`

<div id="verification-email-code-template-variables">
  ### 確認メール (コード) のテンプレート変数
</div>

* `code`：確認コード

<div id="verification-email-link-template-variables">
  ### 確認メール (リンク) のテンプレート変数
</div>

* `url`：確認リンク
