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.0a7.tar.gz (13.5 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.0a7-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

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

Hashes for nonebot_adapter_mail-1.0.0a7.tar.gz
Algorithm Hash digest
SHA256 3aca314467d6f7331059e1d01a939172a2f72e7bce4d4d7f3a637fe5a23f84fd
MD5 63b1522a6874da69cf95a931c2f707e7
BLAKE2b-256 742197b4d9656728390a5a7aa3f885165bb1acacfea735660a720a871e8f4ddc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nonebot_adapter_mail-1.0.0a7-py3-none-any.whl
Algorithm Hash digest
SHA256 b9676c2569dd311c56b45266c765376916f66757d9b4d6674ad373e6dcfa4e86
MD5 ff5c157d3b29306953a575685bfd1c90
BLAKE2b-256 2ea23b3dd13f462f3f297f3180b5222d4bb2abc4600f25b40732485c8b916d2c

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