【问题标题】:Trying to get Mandrill to send an email (codecademy exercise)试图让 Mandrill 发送电子邮件(codecademy 练习)
【发布时间】:2016-05-17 16:10:44
【问题描述】:

我正在尝试学习如何使用 API,我偶然发现了 codecademy 的 course,我正在学习他们的 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
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 密钥应该可以工作。该课程允许我在之前的练习中进行测试。听说山魈最近有变动,提到

您必须添加 SPF 和 DKIM 记录并验证您的所有权 在您可以通过您的帐户发送电子邮件之前发送域。

我想知道我是否在练习中犯了错误,或者由于最近的变化,该练习是否不再有效。我希望我给你看的链接没有被屏蔽。

这是错误响应:

[{"email":"jack??@yahoo.com","status":"rejected","_id":"?7ec118ce30044d493795081552c57d2","reject_reason":"unsigned"}]

【问题讨论】:

    标签: javascript api mandrill


    【解决方案1】:

    您的代码没有任何问题。我使用我的帐户 api 密钥对其进行了测试,它工作正常。这是关于 Mandrill 最近更改的事情see here

    【讨论】:

    • 感谢您的回答。所以我不能用它来练习 API,因为我需要一个域或网站来​​连接它而我没有?
    猜你喜欢
    • 2016-07-04
    • 2015-04-23
    • 2017-04-30
    • 2014-09-03
    • 2016-07-05
    • 2016-02-28
    • 2015-08-25
    • 2023-03-28
    • 2012-07-06
    相关资源
    最近更新 更多