dword-design / nuxt-mail

Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
Other
247 stars 18 forks source link

How to authorize in smtp? #58

Closed de-soul closed 3 years ago

de-soul commented 3 years ago

My nuxt.config.js is:

...
  modules: [
    '@nuxtjs/axios',
    [
      'nuxt-mail',
      {
        message: {
          to: 'myRecipient@gmail.com',
        },
        smtp: {
          host: 'smtp.gmail.com',
          port: 25,
          auth: {
            user: 'myGoogleAccount@gmail.com',
            pass: 'mySecurePassword',
          },
        },
      },
    ],
  ],
  axios: {
    baseURL: process.env.BASE_URL,
  },
...

I try to send mail from my component:

...
    this.$mail
        .send(this.email)
        .then((data) => {
          return data
      })
      .catch((err) => {
          console.log(err.response.data)
          return err
      })
...

So, i got an error in my console with following text:

Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials b44sm2032014ljr.68 - gsmtp

Question: nuxt-mail module did not support auth options?

lucasctd commented 2 years ago

@de-soul were you able to get this working?

dword-design commented 2 years ago

@lucasctd In most cases this is because you are using your login password instead of an app-specific password. SMTP auth needs an app-specific password configured in the Google security settings.