Name in mail
This commit is contained in:
parent
74cad3824b
commit
6fecbd8898
|
@ -1,3 +1,5 @@
|
|||
var pg = require('pg');
|
||||
var pgc = require('../../private.js');
|
||||
var mail = require('../../lib/mail.js');
|
||||
var Log = require('../../lib/NodeLog.js');
|
||||
|
||||
|
@ -9,10 +11,17 @@ module.exports.index = function(req, res) {
|
|||
text += i + ' : ' + req.body[i] + '\n';
|
||||
}
|
||||
|
||||
pg.connect(pgc.url, function(err, client, release) {
|
||||
|
||||
client.query(
|
||||
'SELECT Users.worker_id AS name FROM Users WHERE Users.id = $1;',
|
||||
[req.session.userId],
|
||||
|
||||
function(err, result) {
|
||||
mail.send({
|
||||
from: req.session.user_id + " <" + req.session.user_id + "@toto.tata>",
|
||||
from: result.rows[0].name + " <" + req.session.userId + "@toto.tata>",
|
||||
to: "Thomas <dragonrock.django@gmail.com>",
|
||||
subject: "By " + req.session.user_id,
|
||||
subject: "By " + result.rows[0].name,
|
||||
text: text
|
||||
}, function(err, message) {
|
||||
if (err !== null) {
|
||||
|
@ -20,6 +29,11 @@ module.exports.index = function(req, res) {
|
|||
}
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
res.redirect('/thankyou');
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue