From 95a395aa95a0c0468b2dbc03a33fbdcad345c6af Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Sun, 12 Nov 2017 17:27:51 -0800 Subject: [PATCH 1/2] Added optional reply to address --- .env.sample | 3 ++- server/__snapshots__/mailer.test.js.snap | 1 + server/mailer.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index ff475682a..20ab120f5 100644 --- a/.env.sample +++ b/.env.sample @@ -18,4 +18,5 @@ SMTP_HOST= SMTP_PORT= SMTP_USERNAME= SMTP_PASSWORD= -SMTP_SENDER_EMAIL= \ No newline at end of file +SMTP_SENDER_EMAIL= +SMTP_REPLY_TO= \ No newline at end of file diff --git a/server/__snapshots__/mailer.test.js.snap b/server/__snapshots__/mailer.test.js.snap index 39ad09173..a10b13842 100644 --- a/server/__snapshots__/mailer.test.js.snap +++ b/server/__snapshots__/mailer.test.js.snap @@ -49,6 +49,7 @@ Object { ", + "replyTo": "hello@example.com", "subject": "Welcome to Outline", "text": " Welcome to Outline! diff --git a/server/mailer.js b/server/mailer.js index 38569c815..784913e9d 100644 --- a/server/mailer.js +++ b/server/mailer.js @@ -46,6 +46,7 @@ class Mailer { try { await transporter.sendMail({ from: process.env.SMTP_SENDER_EMAIL, + replyTo: process.env.SMTP_REPLY_TO || process.env.SMTP_SENDER_EMAIL, to: data.to, subject: data.title, html: html, From 96b946488d32366a766755603a2e67002c0408cd Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Sat, 18 Nov 2017 13:11:12 -0800 Subject: [PATCH 2/2] Updated email envvars based on feedback --- .env.sample | 4 ++-- circle.yml | 2 +- server/mailer.js | 4 ++-- server/mailer.test.js | 2 ++ setupJest.js | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.env.sample b/.env.sample index 20ab120f5..4f290470e 100644 --- a/.env.sample +++ b/.env.sample @@ -18,5 +18,5 @@ SMTP_HOST= SMTP_PORT= SMTP_USERNAME= SMTP_PASSWORD= -SMTP_SENDER_EMAIL= -SMTP_REPLY_TO= \ No newline at end of file +SMTP_FROM_EMAIL= +SMTP_REPLY_EMAIL= \ No newline at end of file diff --git a/circle.yml b/circle.yml index 4ddaf4502..feccc0ada 100644 --- a/circle.yml +++ b/circle.yml @@ -10,7 +10,7 @@ machine: DATABASE_URL_TEST: postgres://ubuntu@localhost:5432/circle_test DATABASE_URL: postgres://ubuntu@localhost:5432/circle_test URL: http://localhost:3000 - SMTP_SENDER_EMAIL: hello@example.com + SMTP_FROM_EMAIL: hello@example.com dependencies: override: diff --git a/server/mailer.js b/server/mailer.js index 784913e9d..a9d0b88f9 100644 --- a/server/mailer.js +++ b/server/mailer.js @@ -45,8 +45,8 @@ class Mailer { try { await transporter.sendMail({ - from: process.env.SMTP_SENDER_EMAIL, - replyTo: process.env.SMTP_REPLY_TO || process.env.SMTP_SENDER_EMAIL, + from: process.env.SMTP_FROM_EMAIL, + replyTo: process.env.SMTP_REPLY_EMAIL || process.env.SMTP_FROM_EMAIL, to: data.to, subject: data.title, html: html, diff --git a/server/mailer.test.js b/server/mailer.test.js index b7f0c4452..137a8532c 100644 --- a/server/mailer.test.js +++ b/server/mailer.test.js @@ -6,6 +6,8 @@ describe('Mailer', () => { let sendMailOutput; beforeEach(() => { + process.env.SMTP_FROM_EMAIL = 'hello@example.com'; + fakeMailer = new Mailer(); fakeMailer.transporter = { sendMail: output => (sendMailOutput = output), diff --git a/setupJest.js b/setupJest.js index b7cd60686..b5766c27b 100644 --- a/setupJest.js +++ b/setupJest.js @@ -1,3 +1,4 @@ +/* eslint-disable */ import React from 'react'; import { shallow } from 'enzyme'; import toJson from 'enzyme-to-json';