Created
July 19, 2018 18:23
-
-
Save pepesenaris/f15f808c0581db091aefc250935fdfe1 to your computer and use it in GitHub Desktop.
Send email route handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server/index.js | |
const mailer = require("./mailer"); // In the top of the file | |
/* ... */ | |
app.get("/api/send_email", function(req, res) { | |
res.set("Content-Type", "application/json"); | |
const locals = { userName: req.body.userName }; | |
const messageInfo = { | |
email: req.body.email, fromEmail: "info@ingsw.com", | |
fromName: "Star Wars", subject: "Checkout this awesome droids" | |
}; | |
mailer.sendOne("droids", messageInfo, locals); | |
res.send('{"message":"Email sent."}'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment