Skip to content
Snippets Groups Projects
Commit 7faf3b9f authored by SimCAQ-Homologa's avatar SimCAQ-Homologa
Browse files

add message route

parent b136374e
No related branches found
No related tags found
2 merge requests!309Merge new updates into master,!283Homologa
Pipeline #28698 failed
......@@ -26,19 +26,22 @@ const email = require(`../middlewares/email`);
const log = require(`../log`)(module);
messageApp.get('/', (req, res, next) => {
res.json({msg: 'This is the message route'});
})
messageApp.post('/', (req, res, next) => {
var reqName = req.body.name
var reqEmail = req.body.email
var reqContents = req.body.contents
var reqOrigin = req.body.origin ? req.body.origin : "";
var sub = "Contato " + reqOrigin
let mailOptions = {
from: `"${reqName} <${reqEmail}>"`,
text: reqContents
from: `\"${reqName}\" <${reqEmail}>`,
text: reqContents,
subject: sub
}
console.log("reqbody", req.body)
console.log("mail options", mailOptions)
email(mailOptions, (err, info) => {
if(err) {
log.error(err);
......@@ -52,3 +55,4 @@ messageApp.post('/', (req, res, next) => {
})
module.exports = messageApp;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment