我正在尝试发送电子邮件,但它没有通过。 我在README上使用了你的例子,并且还使用了非Helper方法,但它们似乎都没有用。
import { mail } from 'sendgrid';
const helper = mail;
const from_email = new helper.Email('admin@test.com');
const to_email = new helper.Email('someuser@test.com');
const subject = 'Testing';
const content = new helper.Content('text/plain', 'Test Description');
const email = new helper.Mail(from_email, subject, to_email, content);
const sg = require('sendgrid')(process.env.SENDGRID_API_KEY);
const request = sg.emptyRequest({
method: 'POST',
path: '/v3/mail/send',
body: email.toJSON()
});
sg.API(request, function(error, response) {
console.log(response.statusCode);
console.log(response.body);
console.log(response.headers);
});
第一个console.log
吐出statusCode
的{{1}}
第二个202
没有吐出任何东西
最后console.log
吐出了这个:
console.log
答案 0 :(得分:0)
对于有类似问题的人。
我的帐户显然已停用,因为我还没有登录来回答他们的支持查询。所以你需要做的是联系他们的支持团队。