fastify-mailgun
v1.0.0
Published
Fastify plugin that adds MailGun support with incoming webhooks.
Downloads
9
Maintainers
Readme
fastify-mailgun
Fastify plugin that adds MailGun support with incoming webhooks. Under the hood the mailgun-js module is used.
Installation
$ npm install fastify-mailgun
Usage
fastify.register(require('fastify-mailgun'), {
prefix: '/mailgun', // register your webhook (in MailGun) with '/mailgun/webhooks'
apiKey: 'apikey-...', // your MailGun API Key
domain: 'mydomain.com', // you domain name
webhookHandler: async function (data) {
// handle you webhook data
// example: retrieve the message from mailgun store
const storedMessage = await fastify.mailgun.getStoredMessage({ url: data.storage.url })
// example: send a new mail using the mailgun client
await fastify.mailgun.client.messages().send(...)
return true
}
})
Maintainers
Contributing
If you would like to help out with some code, check the details.
Not a coder, but still want to support? Have a look at the options available to donate.
License
Licensed under MIT.