<commit_before>var nodemailer  = require("nodemailer");
var initializer = module.exports;
var path        = require('path');
var mkdirp      = require("mkdirp");

initializer.init = function(stex) {
  var smtpConf = stex.conf.get("smtp");
  if(smtpConf) {
    stex.smtp = nodemailer.createTransport("SMTP",smtpConf);
  } else {
    //ensure the path exists
    var emailPath = path.join(stex.root, "tmp", "smtp");
    mkdirp.sync(emailPath)
    stex.smtp = nodemailer.createTransport("PICKUP", emailPath);
  }
};

initializer.activate = function(stex) {
  global.smtp = stex.smtp;
}

initializer.shutdown = function(stex) {
  if(stex.smtp) {
    stex.smtp.close();
  }
}<commit_msg>Promisify sendEmail<commit_after>var nodemailer  = require("nodemailer");
var initializer = module.exports;
var path        = require('path');
var mkdirp      = require("mkdirp");
var Promise     = require("bluebird");

initializer.init = function(stex) {
  var smtpConf = stex.conf.get("smtp");
  if(smtpConf) {
    stex.smtp = nodemailer.createTransport("SMTP",smtpConf);
  } else {
    //ensure the path exists
    var emailPath = path.join(stex.root, "tmp", "smtp");
    mkdirp.sync(emailPath)
    stex.smtp = nodemailer.createTransport("PICKUP", emailPath);
  }

  stex.smtp.sendMailAsync = Promise.promisify(stex.smtp.sendMail);
};

initializer.activate = function(stex) {
  global.smtp = stex.smtp;
}

initializer.shutdown = function(stex) {
  if(stex.smtp) {
    stex.smtp.close();
  }
}
{'fraction_non_alphanumeric': 0.15368991198375084, 'fraction_numerical': 0.0, 'mean_word_length': 3.94314381270903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '888589', 'n_tokens_mistral': 569, 'n_tokens_neox': 540, 'n_words': 90}