Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodemailer and Mailgun

I'm getting an authentication error when using Nodemailer with Mailgun. Nodemailer docs state that the library works nicely with Mailgun SMTP, but I keep getting this error when running my app:

{ [AuthError: Invalid login - *** *.*.* Mailgun is not loving your login or password]
  name: 'AuthError',
  data: '*** *.*.* Mailgun is not loving your login or password',
  stage: 'auth' }

This is how I set up my transport:

@Transport = nodemailer.createTransport("SMTP",
     service: "Mailgun"
     auth:
         user: "api"
         pass: "**********************"
)

I'm 100% sure my api key is correct. Are there any other requirements I'm missing?

For what it's worth, it works perfectly when I use a Gmail address.

like image 243
Connor Black Avatar asked Dec 12 '22 06:12

Connor Black


1 Answers

you cannot use api key with smtp transport.

Go to mailgun console and grab smtp credentials from domain config and use those.

like image 159
lkan Avatar answered Dec 24 '22 06:12

lkan