Mail adapter for nonebot2
Project description
配置
修改 .env 或 .env.* 文件以配置 Mail 适配器。
MAIL_BOTS
id: 电子邮件地址name: 显示名称password: 登录密码subject: 默认邮件主题imap: IMAP 配置host: IMAP 主机port: IMAP 端口tls: 是否使用 TLS
smtp: SMTP 配置host: SMTP 主机port: SMTP 端口tls: 是否使用 TLS
配置示例:
MAIL_BOTS='
[
{
"id": "i@example.com",
"name": "Name",
"password": "p4ssw0rd",
"subject": "Sent by NoneBot",
"imap": {
"host": "imap.example.com",
"port": 993,
"tls": true
},
"smtp": {
"host": "smtp.example.com",
"port": 465,
"tls": true
}
}
]
'
适配器默认行为
- 邮件主题按以下优先级解析:
- 调用发送时传入的
subject参数 - 消息中的
MessageSegment.subject段 - 回复时使用
Re: 原邮件主题 - 使用配置中的默认
subject
- 调用发送时传入的
- 发送函数可选参数:
cc: 抄送列表bcc: 密送列表subject: 邮件主题in_reply_to: 所回复的邮件的 Message IDreferences: 邮件线程中的邮件 Message ID 列表reply_to: 接收方回复邮件时的默认地址列表
- 发送函数中未指定
references但已指定in_reply_to时,references默认设置为in_reply_to - 快捷发送函数
bot.send的reply=True时的配置:subject未指定时使用Re: 原邮件主题in_reply_to未指定时使用原邮件的 Message IDreferences未指定时使用原邮件的 Message ID
- 消息中含有多个
MessageSegment.subject或MessageSegment.reply时,只取第一个
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_adapter_mail-1.0.0a7.tar.gz.
File metadata
- Download URL: nonebot_adapter_mail-1.0.0a7.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.21.0 CPython/3.10.10 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aca314467d6f7331059e1d01a939172a2f72e7bce4d4d7f3a637fe5a23f84fd
|
|
| MD5 |
63b1522a6874da69cf95a931c2f707e7
|
|
| BLAKE2b-256 |
742197b4d9656728390a5a7aa3f885165bb1acacfea735660a720a871e8f4ddc
|
File details
Details for the file nonebot_adapter_mail-1.0.0a7-py3-none-any.whl.
File metadata
- Download URL: nonebot_adapter_mail-1.0.0a7-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.21.0 CPython/3.10.10 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9676c2569dd311c56b45266c765376916f66757d9b4d6674ad373e6dcfa4e86
|
|
| MD5 |
ff5c157d3b29306953a575685bfd1c90
|
|
| BLAKE2b-256 |
2ea23b3dd13f462f3f297f3180b5222d4bb2abc4600f25b40732485c8b916d2c
|