npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@onebots/adapter-email

v1.0.6

Published

onebots 邮件适配器

Readme

@onebots/adapter-email

onebots 邮件适配器,支持通过 SMTP 发送邮件和 IMAP 接收邮件。

特性

  • ✅ SMTP 发送邮件
  • ✅ IMAP 接收邮件
  • ✅ 支持 HTML 和纯文本邮件
  • ✅ 支持附件
  • ✅ 支持代理配置
  • ✅ 自动轮询新邮件
  • ✅ 支持回复邮件

安装

pnpm add @onebots/adapter-email

配置

email.my_bot:
  # 发件人配置
  from: '[email protected]'
  fromName: '我的机器人'  # 可选
  
  # SMTP 配置(发送邮件)
  smtp:
    host: 'smtp.example.com'
    port: 587
    secure: false
    requireTLS: true
    user: '[email protected]'
    password: 'your_password'
  
  # IMAP 配置(接收邮件)
  imap:
    host: 'imap.example.com'
    port: 993
    tls: true
    user: '[email protected]'
    password: 'your_password'
    pollInterval: 30000  # 轮询间隔(毫秒),默认 30 秒
    mailbox: 'INBOX'    # 监听的邮箱文件夹,默认 INBOX
  
  # 协议配置
  onebot.v11:
    access_token: 'your_token'

使用示例

发送邮件

通过 OneBot 协议发送邮件:

// 发送邮件到 [email protected]
await bot.sendMessage('[email protected]', {
  scene_id: bot.createId('[email protected]'),
  scene_type: 'private',
  message: [
    { type: 'text', data: { text: '这是一封测试邮件' } }
  ]
});

接收邮件

邮件适配器会自动轮询新邮件,并将邮件转换为消息事件:

bot.on('message', (event) => {
  if (event.platform === 'email') {
    console.log('收到邮件:', event.sender.name, event.message);
  }
});

支持的邮件服务商

Gmail

smtp:
  host: 'smtp.gmail.com'
  port: 587
  user: '[email protected]'
  password: 'your-app-password'  # 需要使用应用专用密码

imap:
  host: 'imap.gmail.com'
  port: 993
  user: '[email protected]'
  password: 'your-app-password'

Outlook/Hotmail

smtp:
  host: 'smtp-mail.outlook.com'
  port: 587
  user: '[email protected]'
  password: 'your-password'

imap:
  host: 'outlook.office365.com'
  port: 993
  user: '[email protected]'
  password: 'your-password'

QQ 邮箱

smtp:
  host: 'smtp.qq.com'
  port: 587
  user: '[email protected]'
  password: 'your-authorization-code'  # 需要使用授权码

imap:
  host: 'imap.qq.com'
  port: 993
  user: '[email protected]'
  password: 'your-authorization-code'

注意事项

  1. 应用专用密码:某些邮件服务商(如 Gmail)需要使用应用专用密码,而不是普通密码
  2. 授权码:某些邮件服务商(如 QQ 邮箱)需要使用授权码
  3. 轮询间隔:建议设置合理的轮询间隔,避免过于频繁的请求
  4. 代理配置:如果需要通过代理访问邮件服务器,可以在配置中添加 proxy 字段

相关链接