[英]Send email with Mailgun in angular
This is my code: 这是我的代码:
function sendEmail(){
return $http.post('https://api:<MY SECRET API KEY>@api.mailgun.net/v3/<DOMAIN>/messages', {
from: "hello@<DOMAIN>",
to: 'test@mail.com',
subject: "Subject text",
text: "Body text"
}).then(function(data){
return data;
}, function(error){
//manage error
})
}
This is giving me a 401 Unauthorized error 这给了我一个401未经授权的错误
UPDATE: 更新:
I have find this post where it's fixed --> Mailgun + AngularJS + Auhtentication for http post request 我在固定的位置找到了这个帖子-> Mailgun + AngularJS + Auhtentication用于http帖子请求
In my case, multipart is not needed. 就我而言,不需要多部分。
看起来要使用它们的API,您需要首先由服务器进行身份验证。
Please see https://documentation.mailgun.com/api-intro.html#authentication . 请参阅https://documentation.mailgun.com/api-intro.html#authentication 。 It looked like you need to set the API key in the URL.
看来您需要在URL中设置API密钥。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.