SMTP Connection Problems in adonis Mail


#1

I have created my first adonis app which was great fun. Unfortunately the Mail config throws me the follwing error even though I have tested the config in another node app with express and emailjs where it is working with the exactly the same config. Is there anything I have to add or change in the adonis config/mail.js? Any help is appreciated!

{ Error: Invalid login: 535 Incorrect authentication data
at SMTPConnection._formatError (/Users/Ingo/adonis/mf10/node_modules/nodemailer/lib/smtp-connection/index.js:590:19)
at SMTPConnection._actionAUTHComplete (/Users/Ingo/adonis/mf10/node_modules/nodemailer/lib/smtp-connection/index.js:1319:34)
at SMTPConnection._responseActions.push.str (/Users/Ingo/adonis/mf10/node_modules/nodemailer/lib/smtp-connection/index.js:356:26)
at SMTPConnection._processResponse (/Users/Ingo/adonis/mf10/node_modules/nodemailer/lib/smtp-connection/index.js:746:20)
at SMTPConnection._onData (/Users/Ingo/adonis/mf10/node_modules/nodemailer/lib/smtp-connection/index.js:543:14)
at TLSSocket._socket.on.chunk (/Users/Ingo/adonis/mf10/node_modules/nodemailer/lib/smtp-connection/index.js:693:51)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at TLSSocket.Readable.push (_stream_readable.js:208:10)
at TLSWrap.onread (net.js:594:20)
code: ‘EAUTH’,
response: ‘535 Incorrect authentication data’,
responseCode: 535,
command: ‘AUTH PLAIN’,
status: 500 } ‘Error Code = EAUTH. Error Name: = Error. Error Status: = 500’

And this is my config/mail.js in adonis:

smtp: {
driver: ‘smtp’,
pool: false,
port: 25,
host: ‘mail.your-server.de’,
secure: false,
auth: {
user: Env.get(‘my@user’),
pass: Env.get(‘myPassword’)
},
maxConnections: 15,
maxMessages: 100,
rateLimit: 10
}


#2

Is there any reason that the user name is defined as my@user in the env file?


#3

No, I just did not want to type my credentials. My Mail Server takes an email adress as user credential. I have learned that Adonis Mail is just a Wrapper around nodemail and I remember that nodemail also caused similar problems.


#4

What SMTP server you use? Is it your self-hosted SMTP or something public like Gmail or Mailgun?
I send mails trough Adonis Mail often, and din’t get any errors.

Does your ‘secure’ set right? Many smtp-server require ‘ssl’.


#5

If this is your self-hosted server, did you try to connect to it via Telnet?
https://technet.microsoft.com/ru-ru/library/aa995718(v=exchg.65).aspx


#6

Hi deromanenko,
I’m using a hosted server by the German company Hetzner. The funny thing is that the connection is not working with nodemailer (just tested). When I use emailjs with exactly the same config it works like a breeze. So I guess it’s an issue with my mail provider and nodemailer but I have no clue how to find out.


#7

I finally got it: In nodemailer I must add the options:
authMethod: ‘LOGIN’,
requireTLS: true
otherwise my server defaults to authMethod:‘PLAIN’ which didn’t work out in Telnet. Thanks dromanenko for giving me the hint for testing!


#8

I’m use SMTP connection without problem.
SMTP server gmail.