total_1ère
This commit is contained in:
31
modules/envoie_mail.js
Normal file
31
modules/envoie_mail.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////
|
||||
// LOGGING
|
||||
/////////////////////////////////////////////////
|
||||
const logger = require("../public/js/app/logger");
|
||||
// ENVOIE MAIL GOOGLE MAIL
|
||||
const nodemailer = require('nodemailer');
|
||||
|
||||
|
||||
function envoie_mail(mailOptions) {
|
||||
logger.info("MAIL ENVOI AVANT");
|
||||
var transporter = nodemailer.createTransport({
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
user: process.env.nodemailer_user,
|
||||
pass: process.env.nodemailer_pass
|
||||
}
|
||||
});
|
||||
|
||||
transporter.sendMail(mailOptions, function(error, info){
|
||||
if (error) {
|
||||
logger.info("error" + error);
|
||||
} else {
|
||||
logger.info("Email envoyé: " + info.response);
|
||||
}
|
||||
});
|
||||
logger.info("MAIL ENVOI APRES");
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
envoie_mail
|
||||
}
|
||||
Reference in New Issue
Block a user