You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Strapi中一次性发送邮件给多个收件人?

解决Strapi邮件插件多收件人非法地址错误

你遇到的问题是因为Strapi邮件插件的to参数不支持逗号分隔的字符串格式,正确的多收件人传递方式是使用字符串数组。

修改后的代码示例:

await strapi.plugins['email'].services.email.send({
  to: ['mail1@example.com', 'mail2@example.com'], // 用数组存储多个收件人地址
  from: 'your verified email address', // 例如SendGrid中已验证的发件地址
  cc: 'valid email address',
  bcc: 'valid email address',
  replyTo: 'valid email address',
  subject: 'The Strapi Email plugin worked successfully',
  text: 'Hello world!',
  html: 'Hello world!',
});

额外说明:如果需要给cc或bcc设置多个收件人,同样可以使用数组格式,比如cc: ['cc1@example.com', 'cc2@example.com']。

内容的提问来源于stack exchange,提问作者Sajeban Rex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 02:27:05