const nodemailer = require('nodemailer')
const params={
    host :process.env.SMTP_HOST || 'localhost',
    port :process.env.SMTP_PORT || 25,
    secure: process.env.SMTP_SECURE || false,
    tls:process.env.SMTP_TLS || false,
    auth:{
        user:process.env.SMTP_USER || '',
        pass:process.env.SMTP_PASS || '',
    }
}

const transport = nodemailer.createTransport(params)
async function sendMail(messageConfig){
        return new Promise(async(resolve, reject) => {
            try{

               let info =  await transport.sendMail(messageConfig)
               resolve(info)

            } catch(err){

                reject(err)

            }

        })
}



function loadMailer(config){



}


module.exports ={
    loadMailer,
    sendMail
}