#Invalid login: 534-5.7.9

1 messages · Page 1 of 1 (latest)

scenic zenith
#

Hey everyone!! I'm trying to create an service that send an email through gmail smtp. I use nodemailer for do this but i get this error

#
@Module({
  imports: [
    ConfigModule.forRoot({
      envFilePath: '.env',
      isGlobal: true,
    }),
    MailerModule.forRoot({
      transport: {
        host: process.env.MAIL_HOST,
        auth: {
          user: process.env.MAIL_USER,
          pass: process.env.MAIL_PASSWORD,
        },
      },
      defaults: {
        from: `from ${process.env.MAIL_FROM}`,
      },
    }),
    MongooseModule.forRoot(process.env.DB_URL),
    AuthModule,
    MailModule,
  ],
})
export class AppModule {}
#
import { Injectable } from '@nestjs/common';
import { MailerService } from '@nestjs-modules/mailer';

interface WelcomeEmailContext {
  name: string;
}

@Injectable()
export class MailService {
  constructor(private readonly mailerService: MailerService) {}

  async sendEmail() {
    await this.mailerService.sendMail({
      to: '[email protected]',
      subject: 'Hello :D',
      text: 'Welcome',
      html: '<b>Welcome</b>',
    });
  }
}
scenic zenith
#
@Controller('auth')
export class AuthController {
  constructor(private mail: MailService) {}

  @Post('/sign-up')
  async signUp() {
    await this.mail.sendEmail();

    return ':D';
  }
}
rancid bladeBOT
#

Suggestion for @scenic zenith:
:warning: Please do not screenshot code as it causes a number of issues:

  1. Ease of assistance - If someone wants to copy your code and correct it, they cannot. Making it easy for people to help you is in your best interests.
  2. Editorializing - It's common to try to make images small, which means you're likely to crop out code relevant to your issue
  3. Accessibility - Wide images can be hard to read on mobile devices, and are impossible for screen readers.
  4. Legibility - You cannot read screenshots of code directly, instead you have to open them in an enlarged context.
  5. Bandwidth usage/clutter - Some of our members use metered connections, and it is wasteful for them to download images of text.

For a small amount of code please use a code-block (/rules codeblocks).

green salmon