I'm trying send a e-mail but I only receive bad-request message. Just it. This is my code.
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)}`);
});
If I try send sms with a similar code:
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}`);
});
it works fine. I don't have idea what I'm making wrong to send e-mail. Can someone help me please?
An example in infobip api: Infobip
My client receive this messagem from support: "I made our test domain available: s...email..hub.com This way you can perform shots with for example: cop@s...email..hub.com (or any other variable before @), I've also added 50 email shots so you can test."
Did I miss something in the code?