What would be the best way to call a function from another file and then do something else if the first function is done and returns true?
module.exports = {
  sendEmail: function(user, subject, text) {
    var smtpTransport = nodemailer.createTransport({
      service: 'gmail',
      auth: {
        user: config.email,
        pass: config.gmlpwd
      }
    });
    var mailOptions = {
      to: user,
      from: config.email,
      subject: subject,
      text: text
    };
    smtpTransport.sendMail(mailOptions, function(err) {
      return true
    });
  }
}
mailer.sendEmail(user.email, subject, text, function(){
     //do something here if the function is done successfully, but it never gets called
});
 
     
     
     
    