简体   繁体   English

用Mailgun发送电子邮件

[英]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.

相关问题 如何通过带有angularjs的Mailgun发送电子邮件? - How to send an email via Mailgun with angularjs? 发送电子邮件与mandrill从angular ionic app - send email with mandrill from angular ionic app 如何在angularjs中使用mailgun发送电子邮件 - How to send emails using mailgun in angularjs 如何使用angular js附加文件并发送电子邮件 - how to attach a file and send a email using angular js 使用Angular和Mandrill通过电子邮件发送带有附件的表单结果 - Send a form result with attachment via email using Angular and Mandrill 使用Django Rest Framework和Angular从API端点发送电子邮件 - Send an email from an API endpoint using Django Rest Framework and Angular 如何使用angular js和ionic框架发送电子邮件 - How to send email using angular js and ionic framework 如何使用角度数据将数据发送到php文件中以及如何使用php发送电子邮件并通过移动10位验证 - How to send Data into php file using angular and send email using php with mobile 10 digit validation 确定电子邮件发件人并发送电子邮件 - determine email sender and send email 我正在尝试通过angular发送电子邮件。 我是否以正确的方式处理此问题? - I am trying to send an email via angular. Am I approaching this in the correct manner?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM