<commit_before>import Email from '../models/email.model';
import GmailConnector from '../helpers/mail/GmailConnector';
import config from '../../config/env';
import Promise from 'bluebird';
import nodemailer from 'nodemailer';
import xoauth2 from 'xoauth2';

/* This is just for developing, will be retrieved from user later */
const options = {
    user: config.email.user,
    password: <PASSWORD>,
    host: config.email.host,
    port: config.email.port,
    tls: true,
    mailbox: 'INBOX'
  };

var sendEmail = function(){
var smtpConfig = {
  host: 'smtp.gmail.com',
  port: 465,
  secure: true, // use SSL,
                // you can try with TLS, but port is then 587
  auth: {
    user: '<EMAIL>', // Your email id
    pass: '<PASSWORD>' // Your password
  }
};
console.log("smtpConfig");
console.log(smtpConfig);
var transporter = nodemailer.createTransport(smtpConfig);
// replace hardcoded options with data passed (somedata)

// setup e-mail data with unicode symbols
const sendMailOptions = {
    from: '<<EMAIL>>', // sender address
    to: '<EMAIL>', // list of receivers
    subject: 'Hello test', // Subject line
    text: 'Hello world ', // plaintext body
    html: '<b>Hello world </b>' // html body
};

console.log("now call send mail");

transporter.sendMail(sendMailOptions, function(error, info){
  if(error){
    console.log("error occured");
    console.log(error);
    return false;
  }else{
    console.log('Message sent: ' + info.response);
    return true;
  };
});
}

//just added this for testing 
 sendEmail();

exports.contact = function(req, res){
 // call sendEmail function and do something with it
 sendEmail(somedata);
}


<commit_msg>restrutured smtp connecting<commit_after>import Email from '../models/email.model';
import GmailConnector from '../helpers/mail/GmailConnector';
import config from '../../config/env';
import Promise from 'bluebird';
import nodemailer from 'nodemailer';
import xoauth2 from 'xoauth2';

/* This is just for developing, will be retrieved from user later */
const options = {
    user: config.email.user,
    password: <PASSWORD>,
    host: config.email.host,
    port: config.email.port,
    tls: true,
    mailbox: 'INBOX'
  };

/* This has to be replaced with OAuth later on
Just fix values*/
const smtpConfig = {
    host: 'smtp.gmail.com',
    port: 465,
    secure: true,
    auth: {
      user: '<EMAIL>',
      pass: '<PASSWORD>'
    }
  };

  // setup e-mail data with unicode symbols
const sendMailOptions = {
      from: '<<EMAIL>>', // sender address
      to: '<EMAIL>', // list of receivers
      subject: 'Hello', // Subject line
      text: '<3 ', // plaintext body
      html: '<b>Hello world </b>' // html body
  };

var sendEmail = function(smtpConfig){

var transporter = nodemailer.createTransport(smtpConfig);
// replace hardcoded options with data passed (somedata)

transporter.sendMail(sendMailOptions, function(error, info){
  if(error){
    console.log("error occured");
    console.log(error);
    return false;
  }else{
    console.log('Message sent: ' + info.response);
    return true;
  };
});
}
//just added this for testing
//sendEmail();

{'fraction_non_alphanumeric': 0.14153944020356235, 'fraction_numerical': 0.004452926208651399, 'mean_word_length': 3.2789115646258504, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 19, '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': '1352599', 'n_tokens_mistral': 991, 'n_tokens_neox': 968, 'n_words': 305}