<commit_before>var mailgunCredentials = require('cloud/cloud/mailgun_credentials');
var Mailgun = require('mailgun');

module.exports = function (params, response) {
  Mailgun.initialize(mailgunCredentials.domain, mailgunCredentials.apiKey);

  if ( !params.from_email || !params.from_name || !params.subject || !params.body ) {
    response.error("Please fill everything out");
  }

  Mailgun.sendEmail({
    to: mailgunCredentials.toEmailAddress,
    from: mailgunCredentials.fromEmailAddress,
    subject: params.subject,
    text: params.body
  }, {
    success: function(httpResponse) {
      console.log(httpResponse);
      response.success("Email sent!");
    },
    error: function(httpResponse) {
      console.error(httpResponse);
      response.error("Uh oh, something went wrong");
    }
  });
};
<commit_msg>always send as a user, put the given email and name into the body instead<commit_after>var mailgunCredentials = require('cloud/cloud/mailgun_credentials');
var Mailgun = require('mailgun');

module.exports = function (params, response) {
  Mailgun.initialize(mailgunCredentials.domain, mailgunCredentials.apiKey);

  if ( !params.from_email || !params.from_name || !params.subject || !params.body ) {
    response.error("Please fill everything out");
  }

  var body = "Feedback from :\n" + params.from_name + " <" + params.from_email + ">" + "\n" + params.body;

  Mailgun.sendEmail({
    to: mailgunCredentials.toEmailAddress,
    from: mailgunCredentials.fromEmailAddress,
    subject: "[feedback]: " + params.subject,
    text: body
  }, {
    success: function(httpResponse) {
      console.log(httpResponse);
      response.success("Email sent!");
    },
    error: function(httpResponse) {
      console.error(httpResponse);
      response.error("Uh oh, something went wrong");
    }
  });
};

{'fraction_non_alphanumeric': 0.13611416026344675, 'fraction_numerical': 0.0, 'mean_word_length': 4.092178770949721, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '5192159', 'n_tokens_mistral': 536, 'n_tokens_neox': 537, 'n_words': 110}