diff --git a/server/__snapshots__/mailer.test.js.snap b/server/__snapshots__/mailer.test.js.snap index 184021be..39ad0917 100644 --- a/server/__snapshots__/mailer.test.js.snap +++ b/server/__snapshots__/mailer.test.js.snap @@ -42,7 +42,7 @@ Object { Outline is a place for your team to build and share knowledge. -
 

Welcome to Outline!

Outline is a place for your team to build and share knowledge.

To get started, head to your dashboard and try creating a collection to help document your workflow, create playbooks or help with team onboarding.

You can also import existing Markdown document by drag and dropping them to your collections

 

View my dashboard

 
Outline
+
 

Welcome to Outline!

Outline is a place for your team to build and share knowledge.

To get started, head to your dashboard and try creating a collection to help document your workflow, create playbooks or help with team onboarding.

You can also import existing Markdown document by drag and dropping them to your collections

 

View my dashboard

 
Outline
diff --git a/server/emails/components/Footer.js b/server/emails/components/Footer.js index 21820abf..8f295a2a 100644 --- a/server/emails/components/Footer.js +++ b/server/emails/components/Footer.js @@ -1,17 +1,18 @@ // @flow import React from 'react'; import { Table, TBody, TR, TD } from 'oy-vey'; +import { color } from '../../../shared/styles/constants'; export default () => { const style = { padding: '20px 0', - borderTop: '1px solid #e8e8e8', - color: '#9BA6B2', + borderTop: `1px solid ${color.smokeDark}`, + color: color.slate, fontSize: '14px', }; const linkStyle = { - color: '#9BA6B2', + color: color.slate, textDecoration: 'none', }; @@ -19,7 +20,7 @@ export default () => { -
+ Outline diff --git a/server/emails/index.js b/server/emails/index.js index 67d2c5f6..298941d5 100644 --- a/server/emails/index.js +++ b/server/emails/index.js @@ -15,11 +15,14 @@ router.get('/:type/:format', async ctx => { }; switch (ctx.params.type) { - case 'welcome': - previewMailer.welcome('user@example.com'); - break; + // case 'emailWithProperties': + // previewMailer.emailWithProperties('user@example.com', {...properties}); + // break; default: - throw httpErrors.NotFound(); + if (Object.getOwnPropertyNames(previewMailer).includes(ctx.params.type)) { + // $FlowIssue flow doesn't like this but we're ok with it + previewMailer[ctx.params.type]('user@example.com'); + } else throw httpErrors.NotFound(); } if (!mailerOutput) return; diff --git a/server/mailer.js b/server/mailer.js index 910e7ea4..38569c81 100644 --- a/server/mailer.js +++ b/server/mailer.js @@ -2,7 +2,6 @@ import React from 'react'; import nodemailer from 'nodemailer'; import Oy from 'oy-vey'; -import invariant from 'invariant'; import { baseStyles } from './emails/components/EmailLayout'; import { WelcomeEmail, welcomeEmailText } from './emails/WelcomeEmail'; @@ -22,8 +21,8 @@ type SendMailType = { * * Mailer class to contruct and send emails. * - * To preview emails, add a new preview to `emails/index.js` and visit following - * URLs in development mode: + * To preview emails, add a new preview to `emails/index.js` if they + * require additional data (properties). Otherwise preview will work automatically. * * HTML: http://localhost:3000/email/:email_type/html * TEXT: http://localhost:3000/email/:email_type/text @@ -35,16 +34,17 @@ class Mailer { * */ sendMail = async (data: SendMailType): ?Promise<*> => { - if (this.transporter) { + const { transporter } = this; + + if (transporter) { const html = Oy.renderTemplate(data.html, { title: data.title, headCSS: [baseStyles, data.headCSS].join(' '), previewText: data.previewText, }); - invariant(this.transporter, 'very sure this.transporter exists'); try { - await this.transporter.sendMail({ + await transporter.sendMail({ from: process.env.SMTP_SENDER_EMAIL, to: data.to, subject: data.title,