Javascript 试图让Mandrill发送电子邮件(codecademy练习)
我试图学习如何使用API,我偶然发现了codecademy,我正在学习他们的Mandrill API课程Javascript 试图让Mandrill发送电子邮件(codecademy练习),javascript,api,mandrill,Javascript,Api,Mandrill,我试图学习如何使用API,我偶然发现了codecademy,我正在学习他们的Mandrill API课程 // Create a function to log the response from the Mandrill API function log(obj) { $('#response').text(JSON.stringify(obj)); } // create a new instance of the Mandrill class with your API key
// Create a function to log the response from the Mandrill API
function log(obj) {
$('#response').text(JSON.stringify(obj));
}
// create a new instance of the Mandrill class with your API key
var m = new mandrill.Mandrill('sDJw??-3FK4r1h8aH2vckw');
// create a variable for the API call parameters
var params = {
"message": {
"from_email":"jack??@yahoo.com",
"to":[{"email":"jack??@yahoo.com"}],
"subject": "Sending a text email from the Mandrill API",
"text": "I'm learning the Mandrill API at Codecademy."
}
};
function sendTheMail() {
// Send the email!
m.messages.send(params, function(res) {
log(res);
}, function(err) {
log(err);
});
}
API密钥应该可以工作。这门课让我可以在以前的练习中进行测试。我听说Mandrill最近有一些变化提到
您必须添加SPF和DKIM记录,并验证您的
先发送域,然后才能通过帐户发送电子邮件
我想知道是我在练习中犯了错误,还是因为最近的变化,练习不再起作用了。我希望我给你看的链接没有被屏蔽
以下是错误响应:
[{"email":"jack??@yahoo.com","status":"rejected","_id":"?7ec118ce30044d493795081552c57d2","reject_reason":"unsigned"}]
您的代码中没有任何错误。我使用我的帐户api密钥测试它,它运行良好。这是有关Mandrill最近更改的一些操作谢谢您的回答。所以我不能用它来练习API,因为我需要一个域名或网站来连接它,而我没有?