Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const https = require('https')
- const data = JSON.stringify({
- 'from': 'Rodrigo <rodrigo_fbm@hotmail.com>',
- 'to': 'rodrcle@gmail.com',
- 'subject': 'Test Subject',
- 'html': '<h1>Html body</h1><p>Rich HTML message body.</p>',
- 'text': 'Sample Email Body',
- 'intermediateReport': 'true'
- })
- const options = {
- hostname: '{base_url}.api.infobip.com',
- port: 443,
- path: '/email/1/send',
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json',
- 'Content-Length': data.length,
- 'Authorization': 'Basic Y29wLnNlZ3VyYW...='
- }
- }
- const req = https.request(options, (res) => {
- console.log(`statusCode: ${res.statusCode}`)
- res.on('data', (d) => {
- process.stdout.write(d)
- })
- })
- req.on('error', (error) => {
- console.error(error)
- })
- req.write(data)
- req.end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement