🐛 修复邮件发送功能的小问题
- 修复发件人字段处理,避免空字符串导致发送失败 - 改进SMTP测试错误消息显示,支持详细错误信息 - 更新package-lock.json锁定nodemailer版本 这些修复提升了邮件功能的稳定性和错误提示的友好性。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -695,8 +695,10 @@ async function sendMail(to, subject, html) {
|
||||
throw new Error('SMTP未配置');
|
||||
}
|
||||
|
||||
const from = (config.from && config.from.trim()) ? config.from.trim() : config.auth.user;
|
||||
|
||||
await transporter.sendMail({
|
||||
from: config.from,
|
||||
from,
|
||||
to,
|
||||
subject,
|
||||
html
|
||||
@@ -2879,7 +2881,7 @@ app.post('/api/admin/settings/test-smtp', authMiddleware, adminMiddleware, async
|
||||
res.json({ success: true, message: `测试邮件已发送至 ${target}` });
|
||||
} catch (error) {
|
||||
console.error('测试SMTP失败:', error);
|
||||
res.status(500).json({ success: false, message: '测试邮件发送失败: ' + error.message });
|
||||
res.status(500).json({ success: false, message: '测试邮件发送失败: ' + (error.response?.message || error.message) });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user