default from email
This commit is contained in:
parent
42d0f302bf
commit
3b3fa2a7de
@ -1,9 +1,9 @@
|
||||
import { Provider } from '@nestjs/common';
|
||||
import { FactoryProvider } from '@nestjs/common';
|
||||
import * as nodemailer from 'nodemailer';
|
||||
import { SMTPConfiguration } from 'src/modules/config/config.interfaces';
|
||||
import { ConfigurationService } from 'src/modules/config/config.service';
|
||||
|
||||
export const emailProviders: Provider<any>[] = [
|
||||
export const emailProviders: FactoryProvider<nodemailer.Transporter>[] = [
|
||||
{
|
||||
provide: 'EMAIL_TRANSPORT',
|
||||
useFactory: async (config: ConfigurationService) =>
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import * as nodemailer from 'nodemailer';
|
||||
import { ConfigurationService } from 'src/modules/config/config.service';
|
||||
import { EmailTemplate } from './email.template';
|
||||
|
||||
@Injectable()
|
||||
@ -7,6 +8,7 @@ export class EmailService {
|
||||
constructor(
|
||||
@Inject('EMAIL_TRANSPORT')
|
||||
private transport: nodemailer.Transporter,
|
||||
private config: ConfigurationService,
|
||||
) {}
|
||||
|
||||
public async sendEmail(
|
||||
@ -14,7 +16,7 @@ export class EmailService {
|
||||
subject: string,
|
||||
text: string,
|
||||
html?: string,
|
||||
from = 'no-reply@icynet.eu',
|
||||
from = this.config.get<string>('email.from'),
|
||||
): Promise<any> {
|
||||
return this.transport.sendMail({
|
||||
to,
|
||||
|
Reference in New Issue
Block a user