<commit_before>import debug from 'debug';
import nodemailer from 'nodemailer';
import EmailError from './errors';

const log = debug('uwave:api:v1:email');

export function sendEmail(emailAddress, token, options) {
  const smtpOptions = {
    host: 'localhost',
    port: 25,
    debug: true,
    tls: {
      rejectUnauthorized: false,
    },
  };

  var mailTransport = null;
  if (options.mailTransport) {
    mailTransport = options.mailTransport;
  } else {
    mailTransport = nodemailer;
  }

  // create reusable transporter object using the default SMTP transport
  const transporter = mailTransport.createTransport(smtpOptions);

  // setup e-mail data with unicode symbols
  const mailOptions = {
    from: options.from,
    to: emailAddress,
    subject: options.subject,
    text: `reset url is: https://welovekpop.club/reset/${token}`,
  };

  // send mail with defined transport object
  return transporter.sendMail(mailOptions)
    .then(() => ({}))
}<commit_msg>pass transport into createTransport<commit_after>import debug from 'debug';
import nodemailer from 'nodemailer';
import EmailError from './errors';

const log = debug('uwave:api:v1:email');

export function sendEmail(emailAddress, token, options) {
  const smtpOptions = {
    host: 'localhost',
    port: 25,
    debug: true,
    tls: {
      rejectUnauthorized: false,
    },
  };

  // create reusable transporter object using the default SMTP transport
  const transporter = nodemailer.createTransport(options.mailTransport || smtpOptions);

  // setup e-mail data with unicode symbols
  const mailOptions = {
    from: options.from,
    to: emailAddress,
    subject: options.subject,
    text: `reset url is: https://welovekpop.club/reset/${token}`,
  };

  // send mail with defined transport object
  return transporter.sendMail(mailOptions)
    .then(() => ({}))
}
{'fraction_non_alphanumeric': 0.11609071274298056, 'fraction_numerical': 0.0032397408207343412, 'mean_word_length': 3.7150127226463106, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '7077052', 'n_tokens_mistral': 558, 'n_tokens_neox': 534, 'n_words': 156}