import { Injectable, Logger } from '@nestjs/common';
import { MailerService } from '@nestjs-modules/mailer';

@Injectable()
export class AppMailerService {
  private readonly logger = new Logger(this.constructor.name);

  constructor(private readonly mailerService: MailerService) {}

  async send(msg: any) {
    try {
      return await this.mailerService.sendMail(msg);
    } catch (err) {
      this.logger.error(JSON.stringify(err));
    }
  }
}
