orliesaurus / nodemailer-mailgun-transport

nodemailer is an amazing node module to send emails within any of your nodejs apps. This is the transport plugin that goes with nodemailer to send email using Mailgun 🔫
MIT License
880 stars 97 forks source link

TypeError: Cannot read property 'api_key' of undefined #91

Closed ruairidhwm closed 4 years ago

ruairidhwm commented 4 years ago

I have been using this package without issue in the past, but now get the above error when sending an email.

My code to send matches the documentation, e.g.:

 const auth = {
                auth: {
                    api_key: this.apiKey,
                    domain: this.domain,
                },
            };

const nodemailerMailgun = nodemailer.createTransport(mg(auth));

// send mail

This fails to work and gives the following error:

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'api_key' of undefined 

(node_modules/nodemailer-mailgun-transport/src/index.js:134:26)