Browse Source

Add mail from config

poeti8 7 years ago
parent
commit
ce2fa02d25
2 changed files with 2 additions and 1 deletions
  1. 1 0
      server/config.example.js
  2. 1 1
      server/controllers/authController.js

+ 1 - 0
server/config.example.js

@@ -51,6 +51,7 @@ module.exports = {
   MAIL_PORT: 587,
   MAIL_SECURE: false,
   MAIL_USER: '',
+  MAIL_FROM: '', // Example: "Kutt <support@kutt.it>". Leave empty to use MAIL_USER
   MAIL_PASSWORD: '',
 
   /*

+ 1 - 1
server/controllers/authController.js

@@ -115,7 +115,7 @@ exports.signup = async (req, res) => {
   if (user && user.verified) return res.status(403).json({ error: 'Email is already in use.' });
   const newUser = await createUser({ email, password });
   const mail = await transporter.sendMail({
-    from: config.MAIL_USER,
+    from: config.MAIL_FROM || config.MAIL_USER,
     to: newUser.email,
     subject: 'Verify your account',
     text: verifyMailText.replace('{{verification}}', newUser.verificationToken),