Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparkpost with Node.js transmission error #247

Open
matthewshipman40 opened this issue Nov 30, 2019 · 0 comments
Open

Sparkpost with Node.js transmission error #247

matthewshipman40 opened this issue Nov 30, 2019 · 0 comments

Comments

@matthewshipman40
Copy link

I'm having some trouble sending my first email via Sparkpost with node.JS. Any thoughts on trouble shooting would be greatly appreciated. The code below is part of a google cloud function that always returns the following error object:

{ Error: getaddrinfo EAI_AGAIN api.sparkpost.com:443
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'api.sparkpost.com',
host: 'api.sparkpost.com',
port: '443' }

/////////// Code ///////////////
const SparkPost = require('sparkpost')
const client = new SparkPost('06b7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')

exports.sendMail = functions.https.onCall((context) => {
client.transmissions.send({
content: {
from: 'dropaprop.com', // this is the actual verified domain. I also tried [email protected] where "myname" is an established email address
subject: 'Hello from node-sparkpost',
html: '

Hello world

'
},
recipients: [
{address: '[email protected]'}
]
})
.then(data => {
console.log('Woohoo! You just sent your first mailing!')
console.log(data)
})
.catch(err => {
console.log('Whoops! Something went wrong')
console.log(err)
})
})

/////////////// END CODE ///////////////

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant