> For the complete documentation index, see [llms.txt](https://docs.docbits.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docbits.com/chinese/guan-li-yu-she-zhi/settings/document-processing/import/test-multi-email-import-and-handling-tests.md).

# 测试：电子邮件导入与处理测试

## 测试内容

这些测试用于确保我们的电子邮件导入系统正常运行。主要目标包括：

1. **发送带附件的电子邮件。**
2. **接收电子邮件并将其移动到指定文件夹。**
3. **检查电子邮件是否已读或未读。**
4. **将电子邮件导入我们的系统。**
5. \*\*清理数据：\*\*随后删除电子邮件和已导入的文档。

## 涉及的步骤

1. **设置：**
   * \*\*获取环境设置：\*\*从环境变量加载电子邮件服务器详细信息和凭据。
   * \*\*加密电子邮件密码：\*\*安全地加密电子邮件密码。
2. **发送和管理电子邮件：**
   * \*\*发送电子邮件：\*\*使用 SMTP 函数发送带有指定主题和附件的电子邮件。
   * \*\*移动电子邮件：\*\*使用 IMAP 函数将电子邮件移动到目标文件夹。
   * \*\*列出文件夹：\*\*检查目标文件夹是否存在。
   * \*\*删除电子邮件：\*\*从文件夹中删除电子邮件以清理数据。
   * \*\*检查电子邮件状态：\*\*确认电子邮件是否标记为未读或已读。
3. **测试顺序**

   **初始设置：**

   * \*\*检查连接：\*\*验证与电子邮件服务器的连接并获取连接 ID。
   * \*\*登录测试：\*\*确认使用已存储的凭据可以成功登录。
   * \*\*文件夹检查：\*\*确保电子邮件服务器上存在目标文件夹。

   **电子邮件操作：**

   * \*\*发送测试电子邮件：\*\*发送三封主题各不相同的电子邮件。
   * \*\*获取电子邮件 ID：\*\*从收件箱获取已发送电子邮件的 ID。
   * \*\*移动电子邮件：\*\*将这些电子邮件从收件箱移动到目标文件夹。
   * \*\*检查电子邮件状态：\*\*确保目标文件夹中的电子邮件标记为未读。

   **电子邮件导入：**

   * \*\*获取电子邮件：\*\*将目标文件夹中的电子邮件导入我们的系统。
   * \*\*检查已导入的电子邮件：\*\*确保已正确获取并记录导入的电子邮件。

   **日志验证：**

   * \*\*检查导入日志：\*\*确认已发送电子邮件的主题记录在导入日志中。

   **清理：**

   * \*\*删除已导入的文档：\*\*删除从电子邮件中导入的文档。
   * \*\*删除电子邮件：\*\*从文件夹中删除已发送和移动的电子邮件以完成清理。

### 各项测试的详细说明

* **设置和初始化：**
  * \*\*初始化共享数据：\*\*为测试准备共享数据。
* **电子邮件连接测试：**
  * \*\*获取连接 ID：\*\*检查能否连接到电子邮件服务器并获取连接 ID。
  * \*\*登录验证：\*\*确保能够正常登录电子邮件服务器。
* **文件夹验证测试：**
  * \*\*检查目标文件夹：\*\*确认电子邮件服务器上存在目标文件夹。
  * \*\*验证文件夹列表：\*\*确保服务器返回的文件夹列表符合预期。
* **电子邮件发送和 ID 获取：**
  * \*\*发送电子邮件：\*\*发送三封带有指定主题和附件的测试电子邮件。
  * \*\*获取电子邮件 ID：\*\*从收件箱中获取这些已发送电子邮件的唯一 ID。
* **电子邮件移动和状态检查：**
  * \*\*将电子邮件移动到文件夹：\*\*将测试电子邮件从收件箱移动到目标文件夹。
  * \*\*检查未读状态：\*\*确保移动后这些电子邮件标记为未读。
* **电子邮件获取和响应验证：**
  * \*\*从文件夹获取电子邮件：\*\*将目标文件夹中的电子邮件导入我们的系统。
  * \*\*验证已获取的电子邮件：\*\*确认获取的电子邮件与已发送的电子邮件相符。
* **导入日志验证：**
  * \*\*获取导入日志：\*\*检索已导入电子邮件的日志。
  * \*\*检查日志中的电子邮件主题：\*\*确保测试电子邮件的主题出现在导入日志中。
* **清理：**
  * \*\*删除已导入的文档：\*\*删除从电子邮件中导入的文档。
  * \*\*删除电子邮件：\*\*从收件箱和目标文件夹中删除测试电子邮件，保持数据整洁。

\\


---

# 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.docbits.com/chinese/guan-li-yu-she-zhi/settings/document-processing/import/test-multi-email-import-and-handling-tests.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.
