简体   繁体   English

设置新域后无法从Mailgun发送电子邮件

[英]Unable to send emails from Mailgun after setting up new domain

I added a new domain to mailgun and also successfully verified it but I am unable to send emails from that domain. 我向mailgun添加了一个新域,并且也成功对其进行了验证,但是我无法从该域发送电子邮件。 I am trying to use the mailgun API to send the emails. 我正在尝试使用mailgun API发送电子邮件。 I can send emails from the Mailgun sandbox domain but not from my own domain. 我可以从Mailgun沙箱域发送电子邮件,但不能从我自己的域发送电子邮件。

I have done the following in my code: 我在代码中完成了以下操作:

var api_key = 'api-key-here';
var domain = 'https://api.mailgun.net/v3/MY-DOMAIN-NAME.com';
var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain});

Also within my user signup function I have the following: 同样在用户注册功能中,我还具有以下功能:

var data = {
                from: 'Excited User <DoNotReply@MY-DOMAIN-NAME.com>',
                to: email,
                subject: ' Account Verification',
                text: 'Please click on the following link, or paste this into your browser to complete the process:\n\n' + 'http://' + req.headers.host + '/verify/' + token + '\n\n'
           };

                 mailgun.messages().send(data, function(error, body) {
                      console.log("sending email ")
                 });

It does not send an email and nothing shows up in the domain logs as well. 它不会发送电子邮件,并且域日志中也不会显示任何内容。 Any idea what I am doing wrong? 知道我在做什么错吗?

domain应该只是MY-DOMAIN-NAME.com ,而不是https://api.mailgun.net/v3/MY-DOMAIN-NAME.com ,因为mailgun-js在内部进行处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM