From 55766610d0abd3cb0be93bded524141989dbc508 Mon Sep 17 00:00:00 2001 From: Job Vonk Date: Tue, 5 Nov 2019 09:24:52 +0100 Subject: [PATCH] Working on some mail things --- server/routes/mail.js | 2 +- server/sendmail.js | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 server/sendmail.js diff --git a/server/routes/mail.js b/server/routes/mail.js index d3a1d5b..d298485 100644 --- a/server/routes/mail.js +++ b/server/routes/mail.js @@ -12,7 +12,7 @@ const transporter = nodemailer.createTransport({ port: 587, secure: false, // upgrade later with STARTTLS auth: { - user: "36995@leerling.heerenlanden.nl", + user: "heerenlandencollege@gmail.com", pass: secret } }); diff --git a/server/sendmail.js b/server/sendmail.js new file mode 100644 index 0000000..b9b98a8 --- /dev/null +++ b/server/sendmail.js @@ -0,0 +1,38 @@ +const nodemailer = require('nodemailer'); +const secret = require('./secret'); + +const transporter = nodemailer.createTransport({ + host: "smtp.gmail.com", + port: 587, + secure: false, // upgrade later with STARTTLS + auth: { + user: "heerenlandencollege@gmail.com", + pass: secret + } +}); + +var mailOptions = { + from: 'Surprise box team van Het Heerenlanden', + to: 'aardtaart1@gmail.com', + subject: `Aanvraag voor surprise box `, + html: ` + + +

Beste ,

+

+ Deze email is verzonden omdat u surprise box voor de kerstmarkt van Het Heerenlanden heeft aangevraagd.
+ Om uw aanvraag te bevestigen, moet u om de volgende link klikken:
+ http://localhost:3000/mail/validate/
+ Deze link verloopt na één uur. +

+ +

Met vriendelijk groet,
het surprise box team van Het Heerenlanden

+ + + ` +}; + +transporter.sendMail(mailOptions, function(error, info){ + if (error) console.log(error) + console.log(info) +});