diff options
| author | Adam Soltys <[email protected]> | 2021-06-24 02:52:43 -0400 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-06-24 02:52:43 -0400 |
| commit | 36a05a441a6be0a1a270802c9a38a2265a7b775e (patch) | |
| tree | eac7102bd232b21008f62d1c4e6eca2b74c55784 /lib | |
| parent | de06cbf6141679b2e10ca01bee1e372efc356c91 (diff) | |
| download | coinos-server-36a05a441a6be0a1a270802c9a38a2265a7b775e.tar.gz coinos-server-36a05a441a6be0a1a270802c9a38a2265a7b775e.zip | |
contact form handler
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mail.js | 16 |
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), + from: "[email protected]", + to: "[email protected]" + }; + + mailgun.messages().send(data); + res.send(req.body); + }) +); + imap.once("ready", function() { openInbox(function(err, box) { if (err) throw err; |
