Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 9x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Injectable, Logger } from '@nestjs/common'
import { MailProvider, MailConfig } from './mail-provider.interface'
@Injectable()
export class ConsoleMailProvider implements MailProvider {
private readonly logger = new Logger(ConsoleMailProvider.name)
async send(
to: string,
subject: string,
template: string,
context: Record<string, any>,
attachments?: { filename: string; content: Buffer }[],
config?: MailConfig,
): Promise<void> {
this.logger.log(`================ EMAIL SIMULATION ================`)
this.logger.log(`TO: ${to}`)
this.logger.log(`SUBJECT: ${subject}`)
this.logger.log(`TEMPLATE: ${template}`)
Eif (attachments?.length) {
this.logger.log(`ATTACHMENTS: ${attachments.length} file(s)`)
attachments.forEach((att) =>
this.logger.log(` - ${att.filename} (${att.content.length} bytes)`),
)
}
this.logger.log(`CONTEXT: ${JSON.stringify(context, null, 2)}`)
this.logger.log(`==================================================`)
await Promise.resolve()
}
}
|