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.0a5.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

nonebot_adapter_mail-1.0.0a5-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

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

Hashes for nonebot_adapter_mail-1.0.0a5.tar.gz
Algorithm Hash digest
SHA256 97c592bb3cbcf92f7f34e708773034e0b19d5ecf8cc517c35237071938cb9485
MD5 11e12cd12a5a622bcd12eca30e8cd463
BLAKE2b-256 039c47d6e4b813430ebe8da2e7f33347d361c074113ae215c172374a54708f5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nonebot_adapter_mail-1.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 02a03dd0a19312b996c877efebe785c455d050feb97237f735d1298c8afabf5f
MD5 1e1cd13205fec44a9e41a75807475117
BLAKE2b-256 bdbdc0ff15598165afbbcdd9f7ce775f49275c4a7d77caa7d0e915d7643bddf3

See more details on using hashes here.

Supported by

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