Sendgrid v3 邮件返回 202 但电子邮件不发送

Ada*_*ler 6 email node.js sendgrid sendgrid-api-v3

我正在尝试通过 Sendgrid 向已注册第一个的用户发送电子邮件验证。按照此处找到的 v3_mail 示例,我创建了以下实现:

const querystring = require('querystring');
const helper = require('sendgrid').mail;
const https = require('https');

const url = "http://<mywebsite.com>/users/reset/passwordLoggedOut?";
let sg = require('sendgrid')(process.env.SENDGRID_API_KEY);

const emails = {};

function sendMail(mail){
    const request = sg.emptyRequest({
       method: 'POST',
       path: '/v3/mail/send',
       body: mail.toJSON(),
    });

    sg.API(request, function(error, response) {
       console.log(response.statusCode);
       console.log(response.body);
       console.log(response.headers);
       console.log(error);
    });
}

emails.sendActivationEmail = function(user){
     let qso = {username: user.username, activationCode: user.activationCode};
     let qs = querystring.stringify(qso);
     let from = new helper.Email('Thomas.Talhelm@chicagobooth.edu');
     let to = new helper.Email(user.username);
     let subject = 'Welcome to Psych Study \'16';
     let content = new helper.Content('text/html', "<p> Thanks for signing up " +
    "for our psych study, please <a href=\"http://<mywebsite.com>/users/validate/account?" + 
     qs + "\">confirm your email</a></p>");

     let mail = new helper.Mail(from, subject, to, content);

     sendMail(mail);

     console.log('Mail Sent!');
}

module.exports = emails;
Run Code Online (Sandbox Code Playgroud)

每当我注册用户时,这些函数最终都会被调用而不会出现错误,尽管我收到状态代码 202(已收到响应,电子邮件已排队等待发送),并且电子邮件从未发送。该问题与此有点类似,但即使我已通过明确定义的环境变量正确输入了 SendGrid API,我的活动日志仍为空白。我尝试重新创建 API 密钥,使用该密钥的完全权限,但尚未从 API 中找到对此行为的解释。