From 3dbc8d040d0e45a7935e7f7447a0bfa7855fd161 Mon Sep 17 00:00:00 2001
From: Rosanny <rosanny.sihombing@hft-stuttgart.de>
Date: Fri, 6 Mar 2020 14:01:24 +0100
Subject: [PATCH] separate nodemailer initialization

---
 routes/mailer.js | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 routes/mailer.js

diff --git a/routes/mailer.js b/routes/mailer.js
new file mode 100644
index 0000000..510b5bb
--- /dev/null
+++ b/routes/mailer.js
@@ -0,0 +1,31 @@
+const nodemailer = require('nodemailer')
+
+var env = process.env.NODE_ENV || 'development';
+const config = require('../config/config')[env]
+
+var smtpTransport = nodemailer.createTransport({
+    host: config.mailer.host,
+    secureConnection: config.mailer.secureConnection,
+    port: config.mailer.port,
+    auth: {
+      user: config.mailer.authUser,
+      pass: config.mailer.authPass
+    },
+    tls: {
+        ciphers: config.mailer.tlsCiphers
+    } 
+});
+  
+var mailOptions = {
+    to: "",
+    from: config.mailer.from,
+    subject: "",
+    text: ""
+};
+
+var mailer = {
+    transport: smtpTransport,
+    options: mailOptions
+}
+
+module.exports = mailer
\ No newline at end of file
-- 
GitLab