- Mail profile submission info and approval link
- Stuff
This commit is contained in:
32
modules/mailer.js
Normal file
32
modules/mailer.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const Mailer = require('nodemailer');
|
||||
|
||||
function sendMail (options, callback) {
|
||||
// create reusable transporter object using the default SMTP transport
|
||||
let transporter = Mailer.createTransport({
|
||||
host: 'mail.fitz.guru',
|
||||
port: 587,
|
||||
secure: false, // secure:true for port 465, secure:false for port 587
|
||||
auth: {
|
||||
user: 'support@fitz.guru',
|
||||
pass: 'NotSt@ff3d!'
|
||||
}
|
||||
});
|
||||
|
||||
callback = typeof callback === 'function' ? callback : (error, info) => {
|
||||
if (error) {
|
||||
return console.error(error);
|
||||
}
|
||||
|
||||
console.debug('Message %s sent: %s', info.messageId, info.response);
|
||||
};
|
||||
|
||||
// send mail with defined transport object
|
||||
transporter.sendMail(options, callback);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
send: (email, callback) => {
|
||||
sendMail(mail, callback);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user