<commit_before>const logger = require('heimdalljs-logger')('email');
const nodemailer = require('nodemailer');

module.exports = class EmailMessenger {
  static create() {
    return new this();
  }
  constructor() {
    this.transporter = nodemailer.createTransport({
      host: 'smtp.mailgun.org',
      auth: {
        user: '<EMAIL>',
        pass: '<PASSWORD>'
      }
    }, {
      from: '<EMAIL>'
    });
  }
  async send(message, params) {
    return this.transporter.sendMail(message);
  }
};
<commit_msg>Configure email messenger to actually send messages<commit_after>const logger = require('heimdalljs-logger')('email');
const nodemailer = require('nodemailer');

module.exports = class EmailMessenger {
  static create(params) {
    return new this(params);
  }
  constructor(params) {
    this.params = params;
    ['smtpPasswordEnvVar', 'smtpHost', 'smtpUser', 'defaultFrom'].forEach( prop => {
      if (!params[prop]) {
        throw new Error(`Could not find ${prop} in message sink params`);
      }
    });
    this.transporter = nodemailer.createTransport({
      host: params.smtpHost,
      auth: {
        user: params.smtpUser,
        pass: process.env[params.smtpPasswordEnvVar]
      }
    }, {
      from: params.defaultFrom
    });
  }
  async send(message) {
    logger.info(`Sending mail to ${message.to}: ${message.subject}`);
    return this.transporter.sendMail(message);
  }
};

{'fraction_non_alphanumeric': 0.14689265536723164, 'fraction_numerical': 0.0, 'mean_word_length': 3.1923076923076925, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, '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': '4524617', 'n_tokens_mistral': 446, 'n_tokens_neox': 438, 'n_words': 91}