models/User.js
function signupEmail(user){
  var port = process.env.MAIL_PORT
  var useremail = process.env.MAIL_USERNAME
  var passwords = process.env.MAIL_PASSWORD
  var host = process.env.MAIL_HOST
  var temp = {}
  'use strict';
  var nodemailer = require('nodemailer');
// create reusable transporter object using the default SMTP transport
var transporter = nodemailer.createTransport({
  host: host,
  tls: {
    rejectUnauthorized: false
  },
    secure: false, // secure:true for port 465, secure:false for port 587
    auth: {
      user: useremail,
      pass: passwords,
    }
  }); 
var mailOptions = {
  from: user.username + ' ' + '<'+ user.email + '>', // sender address
  to: process.env.MAIL_USERNAME, // list of receivers
  subject: '✔ A user has edited their information '+ sitename + '.', // Subject line
  html:  '<h2>The following user has been edited.</h2><p>Code :</p> <pre>'+user+'</pre>',
}
// send mail with defined transport object
transporter.sendMail(mailOptions, (error, info) => {
  if (error) {
    return console.log(error);
  }
});
}
function signupEmail(user){
  var port = process.env.MAIL_PORT
  var useremail = process.env.MAIL_USERNAME
  var passwords = process.env.MAIL_PASSWORD
  var host = process.env.MAIL_HOST
  var temp = {}
  'use strict';
  var nodemailer = require('nodemailer');
// create reusable transporter object using the default SMTP transport
var transporter = nodemailer.createTransport({
  host: host,
  tls: {
    rejectUnauthorized: false
  },
    secure: false, // secure:true for port 465, secure:false for port 587
    auth: {
      user: useremail,
      pass: passwords,
    }
  }); 
var mailOptions = {
  from: user.username + ' ' + '<'+ user.email + '>', // sender address
  to: process.env.MAIL_USERNAME, // list of receivers
  subject: '✔ A user has edited their information '+ sitename + '.', // Subject line
  html:  '<h2>The following user has been edited.</h2><p>Code :</p> <pre>'+user+'</pre>',
}
// send mail with defined transport object
transporter.sendMail(mailOptions, (error, info) => {
  if (error) {
    return console.log(error);
  }
});
}
///////////////////////////////////// //     SIGN UP EMAIL SEND       //// ///////////////////////////////////