<commit_before>var Future = Npm.require('fibers/future');
var urlModule = Npm.require('url');
var nodemailer = Npm.require('node4mailer');

Email = {};
EmailTest = {};

EmailInternals = {
  NpmModules: {
    mailcomposer: {
      version: Npm.require('node4mailer/package.json').version,
      module: Npm.require('node4mailer/lib/mail-composer')
    },
    nodemailer: {
      version: Npm.require('node4mailer/package.json').version,
      module: Npm.require('node4mailer')
    }
  }
};

var MailComposer = EmailInternals.NpmModules.mailcomposer.module;

var makeTransport = function (mailUrlString) {
  var mailUrl = urlModule.parse(mailUrlString, true);

  if (mailUrl.protocol !== 'smtp:' && mailUrl.protocol !== 'smtps:') {
    throw new Error("Email protocol in $MAIL_URL (" +
                    mailUrlString + ") must be 'smtp' or 'smtps'");
  }

  // Allow overriding pool setting, but default to true.
  if (!mailUrl.query) {
    mailUrl.query = {};
  }

  if (!mailUrl.query.pool) {
    mailUrl.query.pool = 'true';
  }

  var transport = nodemailer.createTransport(
    urlModule.format(mailUrl));

  transport._syncSendMail = Meteor.wrapAsync(transport.sendMail, transport);
  return transport;
};

var getTransport = function() {
  // We delay this check until the first call to Email.send, in case someone
  // set process.env.MAIL_URL in startup code. Then we store in a cache until
  // process.env.MAIL_URL changes.
  var url = process.env.MAIL_URL;<commit_msg>Add warning when using smtp://...:465<commit_after>var Future = Npm.require('fibers/future');
var urlModule = Npm.require('url');
var nodemailer = Npm.require('node4mailer');

Email = {};
EmailTest = {};

EmailInternals = {
  NpmModules: {
    mailcomposer: {
      version: Npm.require('node4mailer/package.json').version,
      module: Npm.require('node4mailer/lib/mail-composer')
    },
    nodemailer: {
      version: Npm.require('node4mailer/package.json').version,
      module: Npm.require('node4mailer')
    }
  }
};

var MailComposer = EmailInternals.NpmModules.mailcomposer.module;

var makeTransport = function (mailUrlString) {
  var mailUrl = urlModule.parse(mailUrlString, true);

  if (mailUrl.protocol !== 'smtp:' && mailUrl.protocol !== 'smtps:') {
    throw new Error("Email protocol in $MAIL_URL (" +
                    mailUrlString + ") must be 'smtp' or 'smtps'");
  }

  if (mailUrl.protocol === 'smtp:' && mailUrl.port === '465') {
    Meteor._debug("$MAIL_URL is of the form smtp://...:465 -- did you mean smtps://...:465? (Note added 's' to enable SSL.)");
  }

  // Allow overriding pool setting, but default to true.
  if (!mailUrl.query) {
    mailUrl.query = {};
  }

  if (!mailUrl.query.pool) {
    mailUrl.query.pool = 'true';
  }

  var transport = nodemailer.createTransport(
    urlModule.format(mailUrl));

  transport._syncSendMail = Meteor.wrapAsync(transport.sendMail, transport);
  return transport;
};

var getTransport = function() {
  // We delay this check until the first call to Email.send, in case someone
  // set process.env.MAIL_URL in startup code. Then we store in a cache until
  // process.env.MAIL_URL changes.
  var url = process.env.MAIL_URL;
{'fraction_non_alphanumeric': 0.14415829145728642, 'fraction_numerical': 0.006909547738693468, 'mean_word_length': 3.473314606741573, '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': '4297484', 'n_tokens_mistral': 1063, 'n_tokens_neox': 1039, 'n_words': 240}