I make a mailer with nodejs but i have some problems.
var smtpSender;
var smtpMailAdress;
ipcMain.on("mail:send", (err, data) => {
db.query("SELECT * FROM mail_accounts", (error, results, fields) => {
var string=JSON.stringify(results);
var json = JSON.parse(string);
smtpSender = nodemailer.createTransport({
host: json[0].host,
port: json[0].port,
auth: {
user: json[0].username,
pass: json[0].password
}
});
smtpMailAdress = json[0].username
});
console.log(smtpSender);
console.log(smtpMailAdress);
});
smtpSender and smtpMailAdress is not updated it still undefined. How can i figure it.Thanks.