_为 Node.js 使用 v3 邮件。_
在 v3 Mail 的文档中,在“Node.js”代码示例下,您在 _line 11_ 上指定要编写
var sg = require('sendgrid').SendGrid(process.env.SENDGRID_API_KEY)
然而,当我做时,收到TypeError: require(...).SendGrid is not a function
在之间的时间段与一个指针^(克拉) )
和SendGrid(process.env.SENDGRID_API_KEY)
。
但是,当我这样做时...
const sendGrid = require('sendgrid')(process.env.SENDGRID_API_KEY); //removing the .SendGrid method
console.log('sendGrid: ', sendGrid);
我没有收到任何错误,我可以成功发送电子邮件。
如果我遗漏了什么,请告诉我,但是,如果我没有遗漏,您可以考虑更新您的文档以消除未来的混乱。
聚苯乙烯
SendGrid 很棒。 继续做好工作。
-托比亚雷克斯
你好@TobiahRex ,
感谢您的提醒!
我们将深入研究并进行适当的修复。
嗨@thinkingserious ,
很高兴听到您能够进行必要的更改。 谢谢回复!
-托比
最有用的评论
我已更新代码示例以匹配此库的新更新: https :
最近有一个重大更改,我未能更新 docs.sendgrid.com 上的文档。
再次感谢!