簡體   English   中英

用Mailgun發送電子郵件

[英]Send email with Mailgun in angular

這是我的代碼:

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未經授權的錯誤

更新:

我在固定的位置找到了這個帖子-> Mailgun + AngularJS + Auhtentication用於http帖子請求

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

看起來要使用它們的API,您需要首先由服務器進行身份驗證。

請參閱https://documentation.mailgun.com/api-intro.html#authentication 看來您需要在URL中設置API密鑰。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM