Skip to main content

Mail adapter for nonebot2

Project description

nonebot-adapter-mail

NoneBot-Adapter-Mail

✨ Mail Adapter ✨

license pypi python pre-commit

配置

修改 .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
    }
  }
]
'

适配器默认行为

  • 邮件主题按以下优先级解析:
    1. 调用发送时传入的 subject 参数
    2. 消息中的 MessageSegment.subject
    3. 回复时使用 Re: 原邮件主题
    4. 使用配置中的默认 subject
  • 发送函数可选参数:
    • cc: 抄送列表
    • bcc: 密送列表
    • subject: 邮件主题
    • in_reply_to: 所回复的邮件的 Message ID
    • references: 邮件线程中的邮件 Message ID 列表
    • reply_to: 接收方回复邮件时的默认地址列表
  • 发送函数中未指定 references 但已指定 in_reply_to 时,references 默认设置为 in_reply_to
  • 快捷发送函数 bot.sendreply=True 时的配置:
    • subject 未指定时使用 Re: 原邮件主题
    • in_reply_to 未指定时使用原邮件的 Message ID
    • references 未指定时使用原邮件的 Message ID
  • 消息中含有多个 MessageSegment.subjectMessageSegment.reply 时,只取第一个

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_adapter_mail-1.0.0a6.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_adapter_mail-1.0.0a6-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_adapter_mail-1.0.0a6.tar.gz.

File metadata

  • Download URL: nonebot_adapter_mail-1.0.0a6.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.21.0 CPython/3.10.10 Windows/10

File hashes

Hashes for nonebot_adapter_mail-1.0.0a6.tar.gz
Algorithm Hash digest
SHA256 9c1faf23d39358973d27f81b4d063f25c3b5285c3ba8ffb0c326c89aa6e4c4cd
MD5 7178928b63f66e2e9fdb9f6e3a82767d
BLAKE2b-256 70e97433d98d96654db8e896a6919a6344307006e1fd138de89c777384fbfa8f

See more details on using hashes here.

File details

Details for the file nonebot_adapter_mail-1.0.0a6-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_adapter_mail-1.0.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 9c3a33fc9b8dc184c30e3dc5a13a9fcfc5285d3a260dfc903cfbd4b3c8fc7388
MD5 d0c286a4c401131319215727f7d9c625
BLAKE2b-256 59f6091257a234db4f69f4d77944adc827838a84d4c69325ca29d2b5582f1ad9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page