projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Shogun Chess
[vchess.git]
/
server
/
utils
/
mailer.js
diff --git
a/server/utils/mailer.js
b/server/utils/mailer.js
index
9d3ea30
..
96fa75c
100644
(file)
--- a/
server/utils/mailer.js
+++ b/
server/utils/mailer.js
@@
-1,21
+1,21
@@
const nodemailer = require('nodemailer');
const params = require("../config/parameters");
const nodemailer = require('nodemailer');
const params = require("../config/parameters");
-module.exports = function(from, to, subject, body, cb)
-{
+module.exports = function(from, to, subject, body, cb) {
// Avoid the actual sending in development mode
// Avoid the actual sending in development mode
- if (params.env === 'development')
- {
+ if (params.env === 'development') {
console.log("New mail: from " + from + " / to " + to);
console.log("Subject: " + subject);
console.log("New mail: from " + from + " / to " + to);
console.log("Subject: " + subject);
- let msgText = body.split('\\n');
- msgText.forEach(msg => { console.log(msg); });
- if (!cb)
- cb = (err) => { if (!!err) console.log(err); }
- return cb();
+ console.log(body);
+ if (!cb) cb = (err) => { if (err) console.log(err); }
+ cb();
+ return;
}
}
- else if (!cb)
- cb = () => {}; //default: do nothing (TODO: log somewhere)
+
+ // Production-only code from here:
+
+ // Default: do nothing (TODO: log somewhere)
+ if (!cb) cb = () => {};
// Create reusable transporter object using the default SMTP transport
const transporter = nodemailer.createTransport({
// Create reusable transporter object using the default SMTP transport
const transporter = nodemailer.createTransport({
@@
-39,10
+39,8
@@
module.exports = function(from, to, subject, body, cb)
// Send mail with the defined transport object
transporter.sendMail(mailOptions, (error, info) => {
// Send mail with the defined transport object
transporter.sendMail(mailOptions, (error, info) => {
- if (!!error)
- return cb(error);
// Ignore info. Option:
//console.log('Message sent: %s', info.messageId);
// Ignore info. Option:
//console.log('Message sent: %s', info.messageId);
-
return cb(
);
+
cb(error
);
});
});
-}
+}
;