Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/interfaces/mailer-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface MailerOptions {
defaults?: Options;
transport?: TransportType;
transports?: {
[name: string]: SMTPTransport | SMTPTransport.Options | string;
[name: string]: TransportType;
};
template?: {
dir?: string;
Expand Down
7 changes: 3 additions & 4 deletions lib/mailer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { get, defaultsDeep } from 'lodash';
import { Injectable, Inject, Optional, Logger } from '@nestjs/common';
import { SentMessageInfo, Transporter } from 'nodemailer';
import * as smtpTransport from 'nodemailer/lib/smtp-transport';

/** Constants **/
import {
Expand All @@ -11,7 +10,7 @@ import {
} from './constants/mailer.constant';

/** Interfaces **/
import { MailerOptions } from './interfaces/mailer-options.interface';
import { MailerOptions, TransportType } from './interfaces/mailer-options.interface';
import { TemplateAdapter } from './interfaces/template-adapter.interface';
import { ISendMailOptions } from './interfaces/send-mail-options.interface';
import { MailerTransportFactory as IMailerTransportFactory } from './interfaces/mailer-transport-factory.interface';
Expand Down Expand Up @@ -106,7 +105,7 @@ export class MailerService {
}
}

private createTransporter(config: string | smtpTransport | smtpTransport.Options, name?: string): Transporter {
private createTransporter(config: TransportType, name?: string): Transporter {
const transporter = this.transportFactory.createTransport(config);
if (this.mailerOptions.verifyTransporters) this.verifyTransporter(transporter, name);
this.initTemplateAdapter(this.templateAdapter, transporter);
Expand Down Expand Up @@ -168,7 +167,7 @@ export class MailerService {
}
}

addTransporter(transporterName: string, config: string | smtpTransport | smtpTransport.Options): string {
addTransporter(transporterName: string, config: TransportType): string {
this.transporters.set(
transporterName,
this.transportFactory.createTransport(config),
Expand Down