Can not send emails with gmail (Username and Password not accepted)

I want to send emails with google but I get the above error, (basic auth.)

the test cmd:

irb(main):003:0> Notify.test_email('', 'Test', 'Test msg').deliver_now
Delivered mail 63aeb8e24e40a_913477c3478a@209.mail (401.5ms)
Traceback (most recent call last):
        2: from (irb):2
        1: from (irb):3:in `rescue in irb_binding'
Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted. Learn more at)

I have created the config as described here:

My config:

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = ""
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = ""
gitlab_rails['smtp_password'] = "the pass" # <- (100 char.)
gitlab_rails['smtp_domain'] = ""
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false

gitlab_rails['smtp_openssl_verify_mode'] = 'peer'

gitlab_rails['gitlab_email_from'] = ''
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
gitlab_rails['gitlab_email_reply_to'] = ''

If you have 2FA enabled on your account, then you need an app password. Also, you have to ensure that your gmail account has basic auth enabled, since Google started disabling this. I believe also, they will do the same as Microsoft, and disable this possibility altogether, meaning you will then need to use oauth.

1 Like

thanks man