修改 .env 或 .env.* 文件以配置 Mail 适配器。
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时,只取第一个
