소스 검색

Added mail config for testing proposal

Oleh T 7 년 전
부모
커밋
4c2c2f06cd
1개의 변경된 파일24개의 추가작업 그리고 10개의 파일을 삭제
  1. 24 10
      server/mail/mail.js

+ 24 - 10
server/mail/mail.js

@@ -1,14 +1,28 @@
-const nodemailer = require('nodemailer');
 const config = require('../config');
+const nodemailer = require('nodemailer');
+
+let mailConfig = {};
 
-const transporter = nodemailer.createTransport({
-  host: config.MAIL_HOST,
-  port: config.MAIL_PORT,
-  secure: config.MAIL_SECURE,
-  auth: {
-    user: config.MAIL_USER,
-    pass: config.MAIL_PASSWORD,
-  },
-});
+if (process.env.NODE_ENV === 'production') {
+  mailConfig = {
+    host: config.MAIL_HOST,
+    port: config.MAIL_PORT,
+    secure: config.MAIL_SECURE,
+    auth: {
+      user: config.MAIL_USER,
+      pass: config.MAIL_PASSWORD,
+    },
+  };
+} else {
+  mailConfig = {
+    host: 'smtp.ethereal.email',
+    port: 587,
+    auth: {
+      user: 'likyqc3fcjtgdnfd@ethereal.email',
+      pass: 'fjmhsR8zJQZ3BKQath',
+    },
+  };
+}
 
+const transporter = nodemailer.createTransport(mailConfig);
 module.exports = transporter;