aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mail.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/mail.js b/lib/mail.js
index 705880d2..9780fab7 100644
--- a/lib/mail.js
+++ b/lib/mail.js
@@ -10,6 +10,22 @@ function openInbox(cb) {
imap.openBox("INBOX", true, cb);
}
+app.post(
+ "/contact",
+ ah((req, res) => {
+ const mailgun = require("mailgun-js")(config.mailgun);
+ let data = {
+ subject: "Contact form",
+ text: JSON.stringify(req.body),
+ };
+
+ mailgun.messages().send(data);
+ res.send(req.body);
+ })
+);
+
imap.once("ready", function() {
openInbox(function(err, box) {
if (err) throw err;