text: const nodemailer = require('nodemailer')
  const mg = require('nodemailer-mailgun-transport')
  
  /**
   * Sends email
   * @param {Object} data - data
   * @param {boolean} callback - callback
   */
  const sendEmailVerification = async (data = {}, callback) => {
    var nodemailer = require('nodemailer');
    var transporter = nodemailer.createTransport({
      host: 'smtp.gmail.com',
      port: 465,
      secure: true, // use SSL
      auth: {
        user: process.env.EMAIL_FROM_ADDRESS,
        pass: process.env.EMAIL_PWD
      }
    });
    const mailOptions = {
      from: `${process.env.EMAIL_FROM_NAME} <${process.env.EMAIL_FROM_ADDRESS}>`,
      to: `${data.user.name} <${data.user.email}>`,
      subject: data.subject,
      html: data.htmlMessage
    }
    transporter.sendMail(mailOptions, (err) => {
      if (err) {
        return callback(false)
      }
      return callback(true)
    })
  }
  
  module.exports = { sendEmailVerification }
  