Advertisement
rodrigofbm

Untitled

Dec 8th, 2018
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const request = require('request');
  2.  
  3. const options = {
  4.   url: 'https://lnp....api.infobip.com/email/1/send',
  5.   reqType: "POST",
  6.   json: {
  7.     from: 'Rodrigo <cop@sd1...m>',
  8.     to: 'rodrc...il.com',
  9.     subject: 'Test Subject',
  10.     html: '<h1>Html body</h1><p>Rich HTML message body.</p>'
  11. },
  12.   headers: {
  13.     'Authorization': 'App ca8c0e09e3ad4058f5b...',
  14.     'Content-Type': 'application/json',
  15.     'Accept': 'application/json'
  16.   }
  17. }
  18.  
  19. request.post(options,(err, response) => {
  20.   if (err){
  21.     return console.log(err)
  22.   }
  23.  
  24.   console.log(`Status code: ${response.statusCode}. Message: ${response.body}`);
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement