mailpit 试用

主要是测试以下mailpit 的一些功能(html check )

环境准备

  • docker-compose
version: '3'
services:
  mailpit:
    image: axllent/mailpit
    container_name: mailpit
    restart: always
    volumes:
      - ./data:/data
    ports:
      - 8025:8025
      - 1025:1025
    environment:
      MP_MAX_MESSAGES: 5000
      MP_DATA_FILE: /data/mailpit.db
      MP_SMTP_AUTH_ACCEPT_ANY: 1
      MP_SMTP_AUTH_ALLOW_INSECURE: 1

nodejs client 发送email

基于了emailjs 库

  • app.mjs
import { SMTPClient } from 'emailjs';
const client = new SMTPClient({
  user: 'dalong@qq.com',
  host: '127.0.0.1',
   port:1025,
  ssl: false,
   timeout:10000, // 注意此参数比较重要,否则会有发送提示超时的问题
   tls:false,
});
 
client.smtp.debug(1);
// send the message and get a callback with an error or details of the message that was sent
client.send(
  {
    text: '<div> this is a demo</dov>',
    from: 'dalong@qq.com',
    to:'test@qq.com',
      "content-type":'text/html; charset=utf-8',
      content:'text/html; charset=utf-8',
    subject: 'testing emailjs',
  },
  (err, message) => {
    console.log(err || message);
  }
);
  • 效果

html check

说明

mailpit 整体使用与MailHog 是类似的,支持官方添加了不少新功能,html check 基于了caniemail 是一个很不错的功能,可以快速的发现邮件内容是否兼容邮件客户端

参考资料

https://www.caniemail.com/
https://github.com/HTeuMeuLeu/caniemail
https://mailpit.axllent.org/docs/install/
https://www.npmjs.com/package/emailjs

posted on   荣锋亮  阅读(173)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-11-16 实现一个简单的golang db driver
2020-11-16 代码判断是否运行在docker环境中
2020-11-16 haproxy opentracing 安装构建说明
2020-11-16 haproxy 2.3 发布
2019-11-16 restql 学习一 安装试用
2018-11-16 drone 1.0 新的构建徽章特性
2017-11-16 lapis 集成openresty最新版本cjson 问题的解决

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示