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
File details
Details for the file nonebot_adapter_mail-1.0.0a5.tar.gz
.
File metadata
- Download URL: nonebot_adapter_mail-1.0.0a5.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.20.1 CPython/3.10.10 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97c592bb3cbcf92f7f34e708773034e0b19d5ecf8cc517c35237071938cb9485 |
|
MD5 | 11e12cd12a5a622bcd12eca30e8cd463 |
|
BLAKE2b-256 | 039c47d6e4b813430ebe8da2e7f33347d361c074113ae215c172374a54708f5a |
File details
Details for the file nonebot_adapter_mail-1.0.0a5-py3-none-any.whl
.
File metadata
- Download URL: nonebot_adapter_mail-1.0.0a5-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.20.1 CPython/3.10.10 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02a03dd0a19312b996c877efebe785c455d050feb97237f735d1298c8afabf5f |
|
MD5 | 1e1cd13205fec44a9e41a75807475117 |
|
BLAKE2b-256 | bdbdc0ff15598165afbbcdd9f7ce775f49275c4a7d77caa7d0e915d7643bddf3 |