diff --git a/src/lib/services/email-service.test.ts b/src/lib/services/email-service.test.ts
index f6fbd2212a..67ba9132aa 100644
--- a/src/lib/services/email-service.test.ts
+++ b/src/lib/services/email-service.test.ts
@@ -40,6 +40,9 @@ test('Can send welcome mail', async () => {
sender: 'noreply@getunleash.ai',
},
getLogger: noLoggerProvider,
+ flagResolver: {
+ isEnabled: () => true,
+ },
} as unknown as IUnleashConfig);
const content = await emailService.sendGettingStartedMail(
'Some username',
diff --git a/src/lib/services/email-service.ts b/src/lib/services/email-service.ts
index 8520cf7f74..bdf2396843 100644
--- a/src/lib/services/email-service.ts
+++ b/src/lib/services/email-service.ts
@@ -10,6 +10,7 @@ import {
productivityReportViewModel,
} from '../features/productivity-report/productivity-report-view-model.js';
import { fileURLToPath } from 'node:url';
+import type { IFlagResolver } from '../types/index.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@@ -85,9 +86,12 @@ export class EmailService {
private readonly sender: string;
+ private flagResolver: IFlagResolver;
+
constructor(config: IUnleashConfig, transportProvider?: TransportProvider) {
this.config = config;
this.logger = config.getLogger('services/email-service.ts');
+ this.flagResolver = config.flagResolver;
const { email } = config;
if (email?.host) {
this.sender = email.sender;
@@ -420,14 +424,21 @@ export class EmailService {
name: this.stripSpecialCharacters(name),
year,
unleashUrl,
+ recipient,
};
+
+ let gettingStartedTemplate = 'getting-started';
+ if (this.flagResolver.isEnabled('newGettingStartedEmail')) {
+ gettingStartedTemplate = 'getting-started-new';
+ }
+
const bodyHtml = await this.compileTemplate(
- 'getting-started',
+ gettingStartedTemplate,
TemplateFormat.HTML,
context,
);
const bodyText = await this.compileTemplate(
- 'getting-started',
+ gettingStartedTemplate,
TemplateFormat.PLAIN,
context,
);
diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts
index 185749ac2d..c0a92fc085 100644
--- a/src/lib/types/experimental.ts
+++ b/src/lib/types/experimental.ts
@@ -66,7 +66,8 @@ export type IFlagKey =
| 'registerFrontendClient'
| 'featureLinks'
| 'projectLinkTemplates'
- | 'reportUnknownFlags';
+ | 'reportUnknownFlags'
+ | 'newGettingStartedEmail';
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
@@ -315,6 +316,10 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_REPORT_UNKNOWN_FLAGS,
false,
),
+ newGettingStartedEmail: parseEnvVarBoolean(
+ process.env.UNLEASH_EXPERIMENTAL_NEW_GETTING_STARTED_EMAIL,
+ false,
+ ),
};
export const defaultExperimentalOptions: IExperimentalOptions = {
diff --git a/src/mailtemplates/getting-started-new/getting-started-new.html.mustache b/src/mailtemplates/getting-started-new/getting-started-new.html.mustache
new file mode 100644
index 0000000000..bde36dfcd5
--- /dev/null
+++ b/src/mailtemplates/getting-started-new/getting-started-new.html.mustache
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+ Welcome to Unleash
+
+
+
+
+
+

+
+
+
+
+
Welcome to Unleash {{ name }}!
+
+ You have been invited to your organization’s Unleash account.
+
+ {{# passwordLink }}
+
+ Start using Unleash by clicking the sign-up link below. Follow the
+ steps provided to set your password and get started.
+
+
+ Set up account
+
+ {{/ passwordLink }}
+ {{^ passwordLink }}
+
+ Start using Unleash by clicking the log in link below.
+
+
+ Log in
+
+ {{/ passwordLink }}
+
+
+
Useful resources
+
Once you are up and running, you might want to take a look at the following resources:
+
+
+
+
Best,
Your Unleash team
+
+
+
+
+
diff --git a/src/mailtemplates/getting-started-new/getting-started-new.plain.mustache b/src/mailtemplates/getting-started-new/getting-started-new.plain.mustache
new file mode 100644
index 0000000000..e9386d25f5
--- /dev/null
+++ b/src/mailtemplates/getting-started-new/getting-started-new.plain.mustache
@@ -0,0 +1,27 @@
+Welcome to Unleash {{ name }}!
+
+You have been invited to your organization's Unleash account.
+
+{{# passwordLink }}
+Start using Unleash by clicking the sign-up link below. Follow the steps provided to set your password and get started.
+
+{{{ passwordLink }}}
+{{/ passwordLink }}
+
+{{^ passwordLink }}
+Start using Unleash by clicking the log in link below.
+
+{{{ unleashUrl }}}
+{{/ passwordLink }}
+
+Once you're up and running, you might want to take a look at the following resources:
+
+- Documentation: https://docs.getunleash.io
+- Code examples: https://github.com/unleash
+- SDKs: https://docs.getunleash.io/reference/sdks
+
+Best,
+Your Unleash team
+
+By starting to use Unleash, you are agreeing to our Terms of Service: https://www.getunleash.io/terms-of-service
+This email was sent to {{ recipient }}