<commit_before>'use strict';

var path          = require('path'),
    Promise       = require('bluebird'),
    nodemailer    = require('nodemailer'),
    EmailTemplate = require('email-templates').EmailTemplate;

// Export For Lambda Handler
module.exports.run = function(event, context, cb) {

  if (!process.env.EMAIL_SERVICE) {
    return cb(new Error('EMAIL_SERVICE env var not set'));
  }

  if (!process.env.EMAIL_SERVICE_USER) {
    return cb(new Error('EMAIL_SERVICE_USER env var not set'));
  }

  if (!process.env.EMAIL_SERVICE_PASS) {
    return cb(new Error('EMAIL_SERVICE_PASS env var not set'));
  }

  var templateDir = path.join(__dirname, 'templates', event.template);
  var template = new EmailTemplate(templateDir);

  Promise.promisifyAll(template);

  template.render(event.context)
    .then(function(result) {
      var transporter = nodemailer.createTransport({
        service: process.env.EMAIL_SERVICE,
        auth: {
          user: process.env.EMAIL_SERVICE_USER,
          pass: <PASSWORD>.env.EMAIL_SERVICE_PASS
        }
      });

      transporter.sendMail({
        from: event.from,
        to: event.to,
        subject: event.subject,
        text: result.text,
        html: result.html
      });
      
      return cb(null, {message: 'Yaay success'});
    })
    .catch(function(e) {
      return cb(new Error('Something went wrong!'));
    });<commit_msg>fixed event pass<commit_after>'use strict';

var path          = require('path'),
    Promise       = require('bluebird'),
    nodemailer    = require('nodemailer'),
    EmailTemplate = require('email-templates').EmailTemplate;

// Export For Lambda Handler
module.exports.run = function(event, context, cb) {

  if (!process.env.EMAIL_SERVICE) {
    return cb(new Error('EMAIL_SERVICE env var not set'));
  }

  if (!process.env.EMAIL_SERVICE_USER) {
    return cb(new Error('EMAIL_SERVICE_USER env var not set'));
  }

  if (!process.env.EMAIL_SERVICE_PASS) {
    return cb(new Error('EMAIL_SERVICE_PASS env var not set'));
  }

  var templateDir = path.join(__dirname, 'templates', event.template);
  var template = new EmailTemplate(templateDir);

  Promise.promisifyAll(template);

  template.render(event.context)
    .then(function(result) {
      var transporter = nodemailer.createTransport({
        service: process.env.EMAIL_SERVICE,
        auth: {
          user: process.env.EMAIL_SERVICE_USER,
          pass: <PASSWORD>.EMAIL_SERVICE_PASS
        }
      });
      
      var event.text = result.text;
      var event.html = result.html;
      
      transporter.sendMail(event);
      
      return cb(null, {message: 'Yaay success'});
    })
    .catch(function(e) {
      return cb(new Error('Something went wrong!'));
    });
{'fraction_non_alphanumeric': 0.12859744990892533, 'fraction_numerical': 0.0, 'mean_word_length': 2.9510791366906477, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7505879', 'n_tokens_mistral': 844, 'n_tokens_neox': 840, 'n_words': 178}