> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/pei-zhi/overleaf-toolkit/email-delivery.md).

# 邮件投递

Overleaf 支持通过两种方式发送电子邮件：简单邮件传输协议（SMTP）和 [亚马逊简单电子邮件服务（SES）](https://aws.amazon.com/ses/). 如果你在本地主机上启用了一个监听本地连接的邮件服务器，则可以使用 SMTP。

## 配置

电子邮件通过以下环境变量进行配置。

#### 发件人配置

| 名称                            | 描述                                                                                                                                |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `OVERLEAF_EMAIL_FROM_ADDRESS` | <p>发件人地址，例如 <a href="mailto:support@mycompany.com"><code>'<support@mycompany.com>'</code></a><br><br>- <strong>必需</strong>: 是</p> |
| `OVERLEAF_EMAIL_REPLY_TO`     | 回复地址，例如 `'noreply@mycompany.com'`                                                                                                 |

#### SMTP

| 名称                                      | 描述                                                                                                                                           |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `OVERLEAF_EMAIL_SMTP_HOST`              | 要连接的主机名或 IP 地址。需要能从 Docker 容器访问。                                                                                                             |
| `OVERLEAF_EMAIL_SMTP_PORT`              | 要连接的端口                                                                                                                                       |
| `OVERLEAF_EMAIL_SMTP_SECURE`            | 如果 `true` 连接到服务器时将使用 TLS。如果 `false` 或未设置，则在服务器支持以下项时使用 TLS： `STARTTLS` 扩展。在大多数情况下，将此值设为 `true` 如果你连接的是端口 `465`。对于端口 `587` 或 `25` 保持为 `false` |
| `OVERLEAF_EMAIL_SMTP_USER`              | 用于向 SMTP 服务器进行身份验证的用户名                                                                                                                       |
| `OVERLEAF_EMAIL_SMTP_PASS`              | 与 SMTP 用户名关联的密码                                                                                                                              |
| `OVERLEAF_EMAIL_SMTP_TLS_REJECT_UNAUTH` | 如果 `false` 这会与使用自签名或无效 TLS 证书的 TLS 服务器建立连接                                                                                                   |
| `OVERLEAF_EMAIL_SMTP_IGNORE_TLS`        | 当 `true` 和 `OVERLEAF_EMAIL_SMTP_SECURE` 为 `false` 时，即使服务器支持以下项，也不使用 TLS： `STARTTLS` 扩展                                                       |
| `OVERLEAF_EMAIL_SMTP_NAME`              | 用于 TLS 验证的可选主机名，如果 `OVERLEAF_EMAIL_SMTP_HOST` 设置为 IP 地址，则默认为该机器的主机名。                                                                         |
| `OVERLEAF_EMAIL_SMTP_LOGGER`            | 当 `true` 将日志消息输出到 `web.log`.                                                                                                                 |

#### Amazon SES SMTP 接口

你可以阅读更多关于使用 Amazon SES SMTP 接口发送电子邮件的内容 [这里](https://docs.aws.amazon.com/ses/latest/dg/send-email-smtp.html).

| 名称                         | 描述                               |
| -------------------------- | -------------------------------- |
| `OVERLEAF_EMAIL_SMTP_HOST` | 要连接的主机名或 IP 地址。需要能从 Docker 容器访问。 |
| `OVERLEAF_EMAIL_SMTP_PORT` | 要连接的端口                           |
| `OVERLEAF_EMAIL_SMTP_USER` | 用于向 SMTP 服务器进行身份验证的用户名           |
| `OVERLEAF_EMAIL_SMTP_PASS` | 与 SMTP 用户名关联的密码                  |

#### Amazon SES API

你可以阅读更多关于使用 Amazon SES API 发送电子邮件的内容 [这里](https://docs.aws.amazon.com/ses/latest/dg/send-email-api.html).

| 名称                                     | 描述                    |
| -------------------------------------- | --------------------- |
| `OVERLEAF_EMAIL_AWS_SES_ACCESS_KEY_ID` | 如果使用 AWS SES，则访问密钥    |
| `OVERLEAF_EMAIL_AWS_SES_SECRET_KEY`    | 如果使用 AWS SES，则秘密密钥    |
| `OVERLEAF_EMAIL_AWS_SES_REGION`        | 如果未设置，默认区域为 US-EAST-1 |

#### 使用实例角色的 AWS SES

| 名称                      | 描述                                                     |
| ----------------------- | ------------------------------------------------------ |
| `OVERLEAF_EMAIL_DRIVER` | 当将此项设置为 `ses`时，电子邮件系统将使用 SES API 方式，并依赖已配置的实例角色发送电子邮件。 |

#### 自定义

| 名称                             | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OVERLEAF_CUSTOM_EMAIL_FOOTER` | <p>附加到所有电子邮件中的自定义 HTML，例如<br><br><strong>示例</strong>: <code>"\<div>本系统由 x 部门运营 \</div> \<div> 如果你有任何问题，请查看我们的常见问题解答 \<a href='</code><a href="https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/https:/somwhere.com&#x27;%3Ehere&#x26;#x3C;/a%3E&#x26;#x3C;/div%3E"><code>[https://somwhere.com'>这里\&#x26;#x3C;/a>\&#x26;#x3C;/div>](https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/pei-zhi/overleaf-toolkit/https:/somwhere.com'>这里\&#x26;#x3C;/a>\&#x26;#x3C;/div>)</code></a><code>"</code></p> |


---

# 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://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/pei-zhi/overleaf-toolkit/email-delivery.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.
