nest-modules / mailer

📨 A mailer module for Nest framework (node.js)
https://nest-modules.github.io/mailer/
MIT License
846 stars 177 forks source link

Error: connect ENOENT alt1.gmail-smtp-in.l.google.com #1183

Open SabiulSabit opened 6 months ago

SabiulSabit commented 6 months ago

I am getting ENOENT alt1.gmail-smtp-in.l.google.com error while sending mail

image

It was working as expected but suddenly it stopped working and throwing the above error

jobs.module.ts

  imports: [
    MailerModule.forRoot({
      transports,
      template: {
        dir: join(__dirname, 'mail-templates'),
        adapter: new HandlebarsAdapter(),
        options: {
          strict: true,
        },
      },
    }),

  ],
...
})

export class JobsModule { }

transports object

  security: {
    host: process.env.EMAIL_SMTP_HOST,
    secure: false,
    auth: {
      user: process.env.SECURITY_EMAIL,
      pass: process.env.SECURITY_EMAIL_PASSWORD,
    },
  },
  notifications: {
    host: process.env.EMAIL_SMTP_HOST,
    secure: false,
    auth: {
      user: process.env.NOTIFICATIONS_EMAIL,
      pass: process.env.NOTIFICATIONS_EMAIL_PASSWORD,
    },
  },
  support: {
    host: process.env.EMAIL_SMTP_HOST,
    secure: false,
    auth: {
      user: process.env.SUPPORT_EMAIL,
      pass: process.env.SUPPORT_EMAIL_PASSWORD,
    },
  },
};

Mail Service

  async sendMail() {
    try {
        this.mailerService.sendMail({
          ...mailCofig
        }).catch(async err => {
          console.log('Error in mail sending', JSON.stringify(err));
          console.trace(err);
        });

    } catch (err) {
      console.log('Error while sending email', JSON.stringify(err));
      console.trace(err);
    }
  }
MuhammadSaidulislam commented 6 months ago

I am also facing the same issue. Last few days trying to solve the issue but i didn't find any solution.