【问题标题】:Unable to send emails from Mailgun after setting up new domain设置新域后无法从 Mailgun 发送电子邮件
【发布时间】:2017-05-25 23:12:57
【问题描述】:

我向 mailgun 添加了一个新域并成功验证了它,但我无法从该域发送电子邮件。我正在尝试使用 mailgun API 发送电子邮件。我可以从 Mailgun 沙盒域发送电子邮件,但不能从我自己的域发送电子邮件。

我在我的代码中做了以下操作:

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

在我的用户注册功能中,我还有以下内容:

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

它不发送电子邮件,域日志中也没有显示任何内容。 知道我做错了什么吗?

【问题讨论】:

    标签: javascript node.js express mailgun


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2017-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-24
      • 1970-01-01
      • 2016-06-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多