diff --git a/public/email/header-logo.png b/public/email/header-logo.png index 8340b6a3e5..304d33dee4 100644 Binary files a/public/email/header-logo.png and b/public/email/header-logo.png differ diff --git a/server/__snapshots__/mailer.test.js.snap b/server/__snapshots__/mailer.test.js.snap index c7071644c9..c128327256 100644 --- a/server/__snapshots__/mailer.test.js.snap +++ b/server/__snapshots__/mailer.test.js.snap @@ -43,7 +43,7 @@ Object { Outline is a place for your team to build and share knowledge. -
 
\\"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 documents by dragging and dropping them to your collections.

 

View my dashboard

 
OutlineTwitterSpectrum
+
 
\\"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 documents by dragging and dropping them to your collections.

 

View my dashboard

 
OutlineTwitterSpectrum
@@ -61,7 +61,7 @@ To get started, head to your dashboard and try creating a collection to help doc You can also import existing Markdown documents by dragging and dropping them to your collections. -http://localhost:3000/dashboard +http://example.com/dashboard ", "to": "user@example.com", } diff --git a/server/emails/WelcomeEmail.js b/server/emails/WelcomeEmail.js index 29caabfbac..62b106d2b7 100644 --- a/server/emails/WelcomeEmail.js +++ b/server/emails/WelcomeEmail.js @@ -8,7 +8,11 @@ import Header from './components/Header'; import Footer from './components/Footer'; import EmptySpace from './components/EmptySpace'; -export const welcomeEmailText = ` +export type Props = { + teamUrl: string, +}; + +export const welcomeEmailText = ({ teamUrl }: Props) => ` Welcome to Outline! Outline is a place for your team to build and share knowledge. @@ -17,10 +21,10 @@ To get started, head to your dashboard and try creating a collection to help doc You can also import existing Markdown documents by dragging and dropping them to your collections. -${process.env.URL}/dashboard +${teamUrl}/dashboard `; -export const WelcomeEmail = () => { +export const WelcomeEmail = ({ teamUrl }: Props) => { return (
@@ -39,9 +43,7 @@ export const WelcomeEmail = () => {

- +

diff --git a/server/emails/components/Body.js b/server/emails/components/Body.js index 2adc4286cc..06c494e64c 100644 --- a/server/emails/components/Body.js +++ b/server/emails/components/Body.js @@ -14,7 +14,7 @@ export default ({ children }: Props) => { - + {children} diff --git a/server/emails/components/Header.js b/server/emails/components/Header.js index f64849c788..fd25e4cb2b 100644 --- a/server/emails/components/Header.js +++ b/server/emails/components/Header.js @@ -13,8 +13,8 @@ export default () => { Outline diff --git a/server/mailer.js b/server/mailer.js index 274a8b33b0..f417b4fe2f 100644 --- a/server/mailer.js +++ b/server/mailer.js @@ -83,14 +83,14 @@ export class Mailer { } }; - welcome = async (opts: { to: string }) => { + welcome = async (opts: { to: string, teamUrl: string }) => { this.sendMail({ to: opts.to, title: 'Welcome to Outline', previewText: 'Outline is a place for your team to build and share knowledge.', - html: , - text: welcomeEmailText, + html: , + text: welcomeEmailText(opts), }); }; diff --git a/server/mailer.test.js b/server/mailer.test.js index 7d2f6e68be..fc0d49455e 100644 --- a/server/mailer.test.js +++ b/server/mailer.test.js @@ -16,7 +16,10 @@ describe('Mailer', () => { }); test('#welcome', () => { - fakeMailer.welcome({ to: 'user@example.com' }); + fakeMailer.welcome({ + to: 'user@example.com', + teamUrl: 'http://example.com', + }); expect(sendMailOutput).toMatchSnapshot(); }); }); diff --git a/server/models/User.js b/server/models/User.js index f2070f9cfc..e5ef8d4c1e 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -6,7 +6,7 @@ import subMinutes from 'date-fns/sub_minutes'; import { DataTypes, sequelize, encryptedFields } from '../sequelize'; import { publicS3Endpoint, uploadToS3FromUrl } from '../utils/s3'; import { sendEmail } from '../mailer'; -import { Star, Collection, NotificationSetting, ApiKey } from '.'; +import { Star, Team, Collection, NotificationSetting, ApiKey } from '.'; const User = sequelize.define( 'user', @@ -158,7 +158,10 @@ User.beforeDestroy(checkLastAdmin); User.beforeDestroy(removeIdentifyingInfo); User.beforeSave(uploadAvatar); User.beforeCreate(setRandomJwtSecret); -User.afterCreate(user => sendEmail('welcome', user.email)); +User.afterCreate(async user => { + const team = await Team.findById(user.teamId); + sendEmail('welcome', user.email, { teamUrl: team.url }); +}); // By default when a user signs up we subscribe them to email notifications // when documents they created are edited by other team members and onboarding