feat: 定制需求提交时发送邮件通知

- 新增 nodemailer 依赖,通过腾讯企业邮 SMTP 发送邮件
- 新建 server/utils/email.js 邮件发送工具
- 定制表单提交后企业微信和邮件通知并行发送
- 不配置 SMTP 环境变量时静默跳过,不影响原有流程

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
这个提交包含在:
Mimingguang
2026-03-25 09:50:59 +08:00
共同撰写人 Claude Opus 4.6
父节点 0f591eaf5b
当前提交 32cd352132
共修改 4 个文件,包含 90 行新增和 3 行删除
+9 -3
查看文件
@@ -20,6 +20,7 @@
import { checkRateLimit } from '../utils/rateLimit'
import { notifyWecom } from '../utils/notify'
import { notifyEmail } from '../utils/email'
import { useDB, schema } from '../utils/db.js'
// 手机号正则
@@ -93,8 +94,8 @@ export default defineEventHandler(async (event) => {
.returning()
.all()
// ── 飞书通知(配置后生效)────────────────────────────
await notifyWecom('🌿 新定制需求 - 呼籁旅行', {
// ── 通知(配置后生效)────────────────────────────────
const notifyFields = {
'编号': String(record.id),
'姓名': formData.name,
'手机': formData.phone,
@@ -105,7 +106,12 @@ export default defineEventHandler(async (event) => {
'特殊需求': formData.activities.length ? formData.activities.join('、') : '无',
'预算': formData.budget || '未选择',
'补充说明': formData.remarks || '无',
})
}
await Promise.all([
notifyWecom('🌿 新定制需求 - 呼籁旅行', notifyFields),
notifyEmail('🌿 新定制需求 - 呼籁旅行', notifyFields),
])
// ── 返回 ──────────────────────────────────────────────
return {