node.js - Strapi 使用 SendGrid“内部错误”发送电子邮件
问题描述
我正在尝试使用 SendGrid 发送电子邮件。但是,它不起作用。我将 SendGrip 配置为
Setup->Guide->Integrate->Web API->Node.js and get "myKeyFromSendGrid"
我设置了文件 config/plugins.js
module.exports = ({ env }) => ({ // ... email: { provider: "sendgrid", providerOptions: { apiKey: env( "myKeyFromSendGrid" ), }, settings: { defaultFrom: "test@test.com", defaultReplyTo: "no-reply@test.com", }, }, // ... });
我启动了我的 Strapi 服务器,并在角色和权限中配置了电子邮件发送给公众。然后,我去 Postman 并使用以下内容创建一个新的 POST 请求“ http://localhost:1337/email ”:
{
"to": "test@example.com",
"from": "test@example.com",
"subject": "Sending with Twilio SendGrid is Fun",
"text": "and easy to do anywhere, even with Node.js",
"html": "<strong>and easy to do anywhere, even with Node.js</strong>"
}
但我不断收到来自 Postman 和 Strapi Debug 的“内部服务器错误”
AssertionError [ERR_ASSERTION]:无法包装非错误对象
在 Function.boomify (C:\Users\GustavoRangel\Documents\Development\sandbox\personal_blog\server\node_modules\boom\lib\index.js:107:14)
在 formatBoomPayload (C:\Users\GustavoRangel\Documents\Development\sandbox\personal_blog\server\node_modules\strapi\lib\middlewares\boom\index.js:47:22) 在 C:\Users\GustavoRangel\Documents\Development\沙箱\personal_blog\server\node_modules\strapi\lib\middlewares\boom\index.js:84:36
在 processTicksAndRejections (internal/process/task_queues.js:97:5)
知道我在做什么错吗?我正在使用 Strapi v3.0.1
解决方案
推荐阅读
- flutter - Dart/Flutter 如何访问列表中的 Map 元素
- python - Python中难以理解的语法 - 将变量作为参数传递
- javascript - 在 Adobe Illustrator (JSX) 中编写脚本时,是否可以从外部文件导入函数?
- discord.js - TypeError:无法读取 Object.module.exports.run 中未定义的属性“角色”
- python - 我正在使用带有 django 模板的 codepen 动画,但什么也没发生
- angular - Angular:嵌套的异步管道使用安全吗?
- python - 从 Mariadb 切换到 Graylog?
- javascript - 如何从父级分派 Iframe 中的自定义事件?
- node.js - Promisify 不是函数
- c - CMake add_executable 如何在内部工作(依赖项和自动源发现)?