【问题标题】:Send email with Mailgun in angular使用 Mailgun 以角度发送电子邮件
【发布时间】:2016-06-22 14:58:44
【问题描述】:

这是我的代码:

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
            })
        }

这给了我一个 401 Unauthorized 错误

更新:

我发现这个帖子已经修复了 --> Mailgun + AngularJS + Auhtentication for http post request

就我而言,不需要多部分。

【问题讨论】:

标签: angularjs email http mailgun unauthorized


【解决方案1】:

看来要使用他们的API,你需要先得到服务器的认证。

【讨论】:

    【解决方案2】:

    请参阅https://documentation.mailgun.com/api-intro.html#authentication。看起来您需要在 URL 中设置 API 密钥。

    【讨论】:

    • 嗯,我也试过了,但没用,继续给我 401 Unauthorized。我需要通过服务器进行身份验证吗?
    • 您需要使用基本身份验证。看到这个:jasonwatmore.com/post/2014/05/26/…
    猜你喜欢
    • 2017-10-12
    • 1970-01-01
    • 2016-01-24
    • 2014-04-14
    • 2015-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-18
    相关资源
    最近更新 更多