> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/ja/build/choose-channel/email.md).

# 会話プラットフォームとの連携：Email

Email チャネルの連携方法：送受信用のメールアカウントの設定（Gmail にはアプリ パスワードが必要）、Agent の紐付け、Agent が受信メールに自動返信する手順と制限事項を説明します。

## 連携前の確認事項 <a href="#pre-integration-checklist" id="pre-integration-checklist"></a>

* [MaiAgent プラットフォーム](https://admin.maiagent.ai/)で「AI アシスタント」を作成済みであること
* 連携するメールアカウントを用意済みであること（Gmail、Outlook、Yahoo、またはカスタムメールサーバー）
* Gmail または Outlook を使用する場合は、先に**アプリ パスワード**（アカウントのパスワードではありません）を生成する必要があります

{% hint style="warning" %}
Gmail では 16 桁のアプリ パスワードが必須で、Google アカウントのパスワードではログインできません。事前に [Google アカウントのセキュリティ](https://myaccount.google.com/apppasswords)でアプリ パスワードを生成してください。
{% endhint %}

## Email チャネルでできること・できないこと <a href="#scope-and-limits" id="scope-and-limits"></a>

Email チャネルは「メール受信 → Agent が自動返信」という仕組みです。MaiAgent は IMAP でこのメールボックス宛ての新着メールを取得し、紐付けた Agent に渡して返信を生成させ、SMTP で送信者に返信します。受信メールと返信はすべて <mark style="color:blue;">すべての会話</mark> に表示され、カスタマーサポート担当者が引き継いで返信することもできます。メールボックス内の既存メールはインポートされず、ユーザーが会話の中でこのメールボックスの内容を検索・照会することもできません。

会話の中でメールを調べたり、要約したり、返信を下書きしたりしたい場合は、MaiGPT の[コネクタ](/maiagent-user-guide/ja/work/maigpt/connectors.md)で Google Workspace（Gmail）または Microsoft 365（Outlook）を連携してください。利用可能なコネクタは、組織のコネクタメニューに表示されるものに従います。

## 連携を開始する <a href="#start-integration" id="start-integration"></a>

### 1. チャネル連携ページを開く <a href="#step-go-to-channel-page" id="step-go-to-channel-page"></a>

左側メニューの <mark style="color:blue;">チャネル</mark> をクリックし、右上の <mark style="color:blue;">チャネルを連携</mark> ボタンをクリックします。

### 2. Email を選択する <a href="#step-select-email" id="step-select-email"></a>

プラットフォーム選択ページで <mark style="color:blue;">Email</mark> をクリックします。

### 3. メールサービスプロバイダーを選択する <a href="#step-select-email-provider" id="step-select-email-provider"></a>

<mark style="color:blue;">メールサービスプロバイダー</mark> のドロップダウンメニューから選択します。

| プロバイダー                   | 説明                                                 |
| ------------------------ | -------------------------------------------------- |
| **Gmail**                | Google のメールボックス。アプリ パスワードが必要です                     |
| **Outlook / Office 365** | Microsoft のメールボックス。2 段階認証を有効にしている場合はアプリ パスワードが必要です |
| **Yahoo Mail**           | Yahoo のメールボックス。アプリ パスワードが必要です                      |
| **カスタム**                 | IMAP/SMTP サーバーのパラメータを自分で設定します                      |

プロバイダーを選択すると、対応する IMAP および SMTP サーバーの設定が自動的に入力されます。

### 4. 接続情報を入力する <a href="#step-fill-connection-info" id="step-fill-connection-info"></a>

#### メールアドレス <a href="#email-address" id="email-address"></a>

連携するメールアドレスを省略せずに入力します（例：`support@yourcompany.com`）。

#### IMAP 設定（受信） <a href="#imap-settings" id="imap-settings"></a>

| 項目            | 説明                                       |
| ------------- | ---------------------------------------- |
| **IMAP サーバー** | 受信サーバーのアドレス（Gmail の場合は `imap.gmail.com`） |
| **IMAP ポート**  | ポート番号（通常は 993）                           |
| **SSL を使用**   | 通信の安全性を確保するため、有効にすることをおすすめします            |

#### SMTP 設定（送信） <a href="#smtp-settings" id="smtp-settings"></a>

| 項目            | 説明                                       |
| ------------- | ---------------------------------------- |
| **SMTP サーバー** | 送信サーバーのアドレス（Gmail の場合は `smtp.gmail.com`） |
| **SMTP ポート**  | ポート番号（通常は 587）                           |
| **TLS を使用**   | 通信の安全性を確保するため、有効にすることをおすすめします            |

#### 認証設定 <a href="#authentication-settings" id="authentication-settings"></a>

| 項目        | 説明                            |
| --------- | ----------------------------- |
| **ユーザー名** | 通常はメールアドレスです                  |
| **パスワード** | アプリ パスワード（アカウントのパスワードではありません） |

### 5. 接続をテストする <a href="#step-test-connection" id="step-test-connection"></a>

入力が完了したら、<mark style="color:blue;">接続テスト</mark> ボタンをクリックします。システムは IMAP（受信）と SMTP（送信）の両方の接続状況を同時にテストします。

* **接続成功**：「接続に成功しました！IMAP および SMTP サーバーへの接続テストに合格しました」と表示されます
* **接続失敗**：具体的なエラー原因（認証失敗、サーバーに接続できないなど）が表示されるので、内容に従って設定を修正してください

{% hint style="danger" %}
保存する前に必ず接続テストを実施し、IMAP と SMTP の両方が正常に接続できることを確認してください。
{% endhint %}

### 6. 基本設定と保存 <a href="#step-basic-settings-and-save" id="step-basic-settings-and-save"></a>

| 項目            | 説明                          |
| ------------- | --------------------------- |
| **チャネル名**     | この連携の名前を付けます                |
| **AI アシスタント** | 紐付ける Agent を選択します           |
| **ポーリング間隔**   | （任意）システムが新着メールを確認する頻度（秒）    |
| **リセットコマンド**  | （任意）ユーザーが会話を最初からやり直すためのコマンド |

設定内容を確認したら、<mark style="color:blue;">保存</mark> をクリックして連携を完了します。

連携が完了すると、そのメールアドレス宛てにメールが届いた際に、Agent がメールの内容を自動的に読み取って返信します。

{% hint style="info" %}
連携に成功すると、チャネル一覧にこの連携が表示されます。編集をクリックすると、機能オプション（時間帯別返信、送信者名の認識、権限管理など）をさらに設定できます。
{% endhint %}

## 受信メールの添付ファイルの扱い <a href="#email-attachments" id="email-attachments"></a>

受信メールの添付ファイル（HTML 本文内のインライン画像を含む）は、そのメッセージの添付ファイルとして保存され、ユーザーが Web Chat でファイルをアップロードした場合と同じ方法で処理されます。

| 添付ファイルの種類                                                      | Agent の読み取り方法                                                                                                                                                                                                            |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 画像（`.png`、`.jpg`、`.gif`、`.webp` など）                            | Agent の言語モデルに直接渡して解釈させます。そのため Agent はマルチモーダル対応のモデルを使用する必要があります。機能設定の <mark style="color:blue;">OCR を有効にする</mark> をオンにすると、画像内のテキストを認識できます                                                                                 |
| ドキュメント（PDF、Word、Excel、CSV、PowerPoint、TXT など、ナレッジベースが対応する形式）と音声 | **Agent は Agent モードを使用する必要があります**：Agent はメールの内容に応じて、添付ファイルツールでファイルを解析するか、全文を読み取るか、インデックスを作成するかを判断し、それに基づいて返信します。Excel／CSV は表形式のテキストに変換されるため、セルの値について回答でき、音声はまず文字起こしに変換されます。それ以外の回答モードでは添付ファイルが保存されるだけで、Agent は内容を読み取れません |

* 解析は Agent の返信時に行われるため、添付ファイルが多い場合やファイルが大きい場合は、最初の返信に時間がかかります。解析にかかる費用は、ナレッジベースのパーサー規則に従って Credits に計上されます。
* 添付ファイルはその会話にのみ属し、ナレッジベースには取り込まれません。保持日数はプラットフォームの添付ファイル クリーンアップ設定に従い、期限を過ぎると添付ファイルと解析コピーは自動的に削除されます。詳しくは [Credits 課金制度](/maiagent-user-guide/ja/others/credits.md#attachment-and-derived-storage)をご覧ください。
* 添付ファイルツールは、Agent の詳細設定で個別に無効にできます。詳しくは [Agent にツールを設定する](/maiagent-user-guide/ja/build/tools/configure_tools.md)をご覧ください。処理の詳細については、[技術者向けマニュアル - メッセージの添付ファイルはどのように処理されるか](https://docs.maiagent.ai/tech/api-integration/api_knowledge#attachment-processing)をご覧ください。

## メールの内容はエクスポートできますか <a href="#email-export" id="email-export"></a>

Email チャネルには「PDF／Excel へのエクスポート」機能はなく、Agent も受信メールの内容をファイルに変換することはありません。受信メールと返信はどちらも会話履歴として残り、[すべての会話](/maiagent-user-guide/ja/serve/daily-operations/reply.md)で確認できるほか、[Agent モニタリング](/maiagent-user-guide/ja/build/agent-ops/evaluations.md)で絞り込んで Excel に一括エクスポートすることもできます（[会話ビューア：一括エクスポート](/maiagent-user-guide/ja/serve/daily-operations/reply/conversation-viewer.md#batch-export)を参照）。1 通のメールの内容をドキュメントにまとめたい場合は、Agent に [Canvas](/maiagent-user-guide/ja/work/maigpt/canvas.md#export) で作成してもらい、ダウンロードしてください。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/maiagent-user-guide/ja/build/choose-channel/email.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
