Invalid greeting. response=421 Server busy, too many connections: 421 Server busy, too many connections -Nest.js Nodemailer

Viewed 125

I'm trying to use the Nest.js MailerModule that interacts with NodeMailer to send emails with outlook smtp on localhost, before pushing it online. But evertime I run it, I get an Invalid greeting. response=421 Server busy, too many connections: 421 Server busy, too many connections error. I've tried differnt port numbers, specified the service of outlook, used tls ciphers. I've even tried zohomail smtp server, but it gave the same error. It once worked with google smtp, but that before they disabled the lesssecureapps feature for accounts. I need help.

Here's the code:

MailerModule:

import { MailerModule } from '@nestjs-modules/mailer';

@Module({
    imports: [
        MailerModule.forRoot({
            transport: {
                host: 'smtp-mail.outlook.com',
                secure: false,
                auth: {
                    user: process.env.OUTLOOK_USER,
                    pass: process.env.OUTLOOK_PASSWORD
                },
                tls: {
                    ciphers: 'SSLv3'
                }
            },
            defaults : {
                from: process.env.OUTLOOK_USER
            } 
        }),
    ],
})
export class MailsModule {}

Code for sending email:

import { MailerService } from '@nestjs-modules/mailer';
    
    constructor(
                private mailerService: MailerService
    ){}
    ...
    ...
    await this.mailerService.sendMail({
                to: <userEmail>,
                subject: "Blah Blah", 
                text: "Blah Blah Blah"
            })
0 Answers
Related