1
我試圖通過mailgun API在angularjs發送,但它不是在這裏工作是我的代碼片段:如何使用angularjs通過Mailgun發送郵件?
console.log('step1');
var mailgunUrl = "DOMAIN_NAME";
var mailgunApiKey = window.btoa("api:key-API_KEY")
$scope.send = function() {
console.log('in here');
$http({
"method": "POST",
"url": "https://api.mailgun.net/v3/" + mailgunUrl + "/messages",
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic " + mailgunApiKey
},
data: "from=" + "[email protected]" + "&to=" + "TO_EMAIL_ADDRESS" + "&subject=" + "MailgunTest" + "&text=" + "EmailBody"
}).then(function (success) {
console.log("SUCCESS " + JSON.stringify(success));
}, function (error) {
console.log("ERROR " + JSON.stringify(error));
});
}
console.log('step last');
它安慰「第一步」和「最後一步」,但它不是發送郵件。
你能幫我一下,或者建議我可以在這裏做些什麼。
感謝
燁,但它不工作 –