| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2024-06-11 10:27:06 |
| 4 | * @LastEditTime: 2024-07-05 15:50:12 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: |
| 7 | */ |
| 8 | import { ISendMailOptions, MailerService } from '@nestjs-modules/mailer'; |
| 9 | import { Injectable } from '@nestjs/common'; |
| 10 | |
| 11 | @Injectable() |
| 12 | export class MailService { |
| 13 | constructor(private readonly mailerService: MailerService) {} |
| 14 | |
| 15 | async sendEmail(p: ISendMailOptions): Promise<boolean> { |
| 16 | try { |
| 17 | const res = await this.mailerService.sendMail(p); |
| 18 | return !!res; |
| 19 | } catch (error) { |
| 20 | console.log('------- sendEmail error --------', error); |
| 21 | return false; |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 |