【问题标题】:Infobip badrequest generic logInfobip badrequest 通用日志
【发布时间】:2019-05-11 12:50:18
【问题描述】:

我正在尝试发送电子邮件,但我只收到错误请求消息。只是它。这是我的代码。

const request = require('request');
var options = {
    url: 'https://ln....api.infobip.com/email/1/send',
    reqType: "POST",
    json:{
      from: 'Sender Name <rodr...mail.com>',
      to: 'cop@sd1....com',
      subject: 'Test Subject',
      text: 'Sample Email Body',
    },
    headers: {
      'Authorization': 'App ca8c0e09e3ad4058f5b462e314c...bb76',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }
}

request.post(options,(errReq, resp) => {
        if (errReq){
          return console.error(errReq);
        }


        console.log(`Status code: ${resp.statusCode}. Message: ${JSON.stringify(resp)}`);
});

Log-part1

Log-part2

如果我尝试使用类似代码发送短信:

const request = require('request');

const options = {
  url: 'https://ln....api.infobip.com/sms/2/text/single',
  json: {
    from: 'Infobip',
    to: '55739916...',
    text: 'Teste'
},
  headers: {
    'Authorization': 'App ca8c0e09e3ad4058f5b462e...',
    'Content-Type': 'application/json',
    'Accept': 'application/json'
  }
}

request.post(options,(err, response) => {
  if (err){
    return console.log(err)
  }

  console.log(`Status code: ${response.statusCode}. Message: ${response.body}`);
});

它工作正常。我不知道我在发送电子邮件时做错了什么。有人可以帮帮我吗?

infobip api 中的一个示例:Infobip

我的客户从支持部门收到此消息: “我提供了我们的测试域:s...email..hub.com 通过这种方式,您可以使用例如:cop@s...email..hub.com 进行拍摄 (或@之前的任何其他变量),我还添加了 50 个电子邮件截图,以便您进行测试。”

我是否遗漏了代码中的某些内容?

【问题讨论】:

    标签: node.js xmlhttprequest infobip infobip-api


    【解决方案1】:

    您使用他们提供的域吗? 也许你可以试试他们的域名:

    来自:“发件人姓名**”

    如果您想与您的公司电子邮件域一起使用,您应该要求客户经理将您的公司电子邮件域添加到他们的平台。

    【讨论】:

    • 我尝试在发件人名称中使用他们的域,但没有成功!问题是关于域的?
    猜你喜欢
    • 2019-04-23
    • 2020-03-14
    • 1970-01-01
    • 2021-11-26
    • 1970-01-01
    • 2018-10-18
    • 1970-01-01
    • 2014-05-08
    • 2013-09-10
    相关资源
    最近更新 更多