Error send email in production Invalid login: 534-5.7.14

Hey i need some help, i send email to confirm account when the user register i use smtp gmail also i use mailgun
in local it’s work fine but when i run the project in producction do not work this is my mail.js

connection: Env.get(‘MAIL_CONNECTION’, ‘smtp’),
smtp: {
driver: ‘smtp’,
pool: true,
port: 587,
// host: Env.get(‘SMTP_HOST’),
host: ‘’,
secure: false,
auth: {
user: ‘MyEmail’,
pass: ‘MyPassword’
maxConnections: 5,
maxMessages: 100,
rateLimit: 10

await Mail.send(‘emails.confirm’,{token:client.token,}, (message) => {
.from(‘’, ‘Systems’)
.subject(‘Confirma Tu Cuenta’)
i run this in localhost it’s fine example:

but if i run in production

i need help i have 2 days try solve this problem i do not have any solution yet

1 Like

Hi, try to set secure to true and port to 465?:no_mouth:

I cant get the mailer to work locally either with gmail. I have the same exact settings as OP, and have also tried {secure:true, port:465}.

I get the error:
{ Error: self signed certificate in certificate chain
at TLSSocket.onConnectSecure (_tls_wrap.js:1140:34)
at TLSSocket.emit (events.js:197:13)
at TLSSocket.EventEmitter.emit (domain.js:439:20)
at TLSSocket._finishInit (_tls_wrap.js:631:8) code: ‘ESOCKET’, command: ‘CONN’ }

Edit fixed my own error (testing locally)
Fixed this error by using the tls details below, then I got another error
“535-5.7.8 Username and Password not accepted” and that was fixed by going to and turning it on.

    tls: {
      rejectUnauthorized: false

Enabling access for “less secure apps” means that the client/app doesn’t use OAuth 2.0 . OAuth 2.0 is the industry-standard protocol for authorization. When you sign in with OAuth 2.0, you sign in to Google’s system directly. In OAuth 2.0 , you authenticate directly to Gmail with your credentials and authorize an app to do certain things. The third-party app only sees an authorization token provided by Google as proof that you authenticated correctly and agreed to authorize that app.

1 Like

First of all, you should check the connection to your SMTP server manually by telnet:

It will be easier to understand where the problem sits. Many mailservers use some not obvious technics to fight the spam, and with telnet you can see what server asking from you step by step.

So it can be problem not in Adonis, but in your SMTP server.

Also, Adonis user NodeMailer under the hood, so you can ask the help in nodemailer community:

1 Like