Nodemailer auth without username password

Viewed 699

I'm deploying my node express project with iis. I'm sending mail with node mailer. but I get the username and password from the config file. Is there any way I can get a username and password parametrically via iis user? I do not want the username and password to be visible. how can I do it?

        var transporter = nodemailer.createTransport({
            host: //config file host- local smtp,
            port: //config file port,
            logger:false,
            secure: false,
            auth: {
                user: //config file user,
                pass: //config file pass
            }
        });

        var mailOptions = {
            from: //config file user,
            to: //config file mailadress,
            subject: //config file subject
            html: //config file data
        };

        transporter.sendMail(mailOptions, function (error, info) {
            if (error) {
                console.log('Error while sending email' + error);
            } else {
                console.log('E-mail send to : ' + info.response);
            }
        });
0 Answers
Related