Smtp Gmail invalid login


I’m trying to send a verification email for accounts but i’m always getting this error :

Invalid login - 535-5.7.8 Username and Password not accepted

This is what i have in my conf file for smtp in the server folder :

Meteor.startup(function () {
var smtp = {
    username: '',
    password: 'password',
    server:   '',
    port: 465

process.env.MAIL_URL = 'smtp://' + encodeURIComponent(smtp.username) + ':' + encodeURIComponent(smtp.password) + '@' + encodeURIComponent(smtp.server) + ':' + smtp.port; });

Did someone already have this issue ?

Thx for help.

I’d console.log() the smtp url as close as possible to sending the email, just a sanity check

Thx for your help chenroth, but i don’t really understand your answer. :confused:

This is what works for me. The only difference is that I use port 587 instead.

Try changing to port 587 (which uses TLS) instead of 465.

Also, did you try and log in with the credentials you put in for username and password on the gmail site? Obviously will not work :wink:

1 Like

Thx for your answer yauh, i just found the solution… That’s my bad, in my password i have the special character “:” and it was encoded by encodeURIComponent… so invalid login :smile: