I have details defined in .env
file. Below is my code.
import { Module } from '@nestjs/common';
import { MailService } from './mail.service';
import { MailController } from './mail.controller';
import { MailerModule } from '@nestjs-modules/mailer';
import { HandlebarsAdapter} from '@nestjs-modules/mailer/dist/adapters/handlebars.adapter';
import { join } from 'path';
@Module({
imports:[
MailerModule.forRoot({
transport:{
host: process.env.SMTP_HOST,
port: 1025,
ignoreTLS: true,
secure: false,
auth:{
user:'shruti.sharma@infosys.com',
pass:'Ddixit90@@',
},
},
defaults:{
from: '"No Reply" <no-reply@localhost>',
},
template:{
dir:join(__dirname,'templates'),
adapter: new HandlebarsAdapter(),
options:{
strict:false,
},
}
}
)
],
controllers: [MailController],
providers: [MailService],
exports:[MailService]
})
export class MailModule {}
host: process.env.SMTP_HOST
is working properly. but when I am writing process.env.SMTP_PORT
it is saying you can not assign string to number.
when I wrote parseInt(process.env.SMTP_PORT)
it is still not working. how to assign port
from .env
file