【发布时间】:2016-01-05 11:14:26
【问题描述】:
我正在为我的 Angular 2 Typescript 应用程序使用 npm install sendgrid。
我已经安装了 sendgrid 和软件包,但我不断收到控制台错误:
"ReferenceError: 要求未定义"
这是我的代码示例(出于显而易见的原因,我删除了密钥):
var sendgrid_api_key = "key goes here";
var sendgrid = require('sendgrid')(sendgrid_api_key);
sendgrid.send({
to: 'mark@gmail.com',
from: 'support@gmail.com',
subject: 'Hello Mark Test',
text: 'My first email through SendGrid.'
}, function(err, json) {
if (err) { return console.error(err); }
console.log(json);
});
【问题讨论】:
-
这与 Angular 有什么关系?
-
我在我的 Angular 2 项目中使用了发送网格,你知道如何让发送网格在这个环境中工作吗?
标签: javascript sendgrid