diff --git a/src/lib/services/email-service.test.ts b/src/lib/services/email-service.test.ts index 6c67d75235..8f97838342 100644 --- a/src/lib/services/email-service.test.ts +++ b/src/lib/services/email-service.test.ts @@ -102,3 +102,32 @@ test('should strip special characters from email subject', async () => { ); expect(emailService.stripSpecialCharacters('tom-jones')).toBe('tom-jones'); }); + +test('Can send order environments email', async () => { + process.env.ORDER_ENVIRONMENTS_BCC = 'bcc@bcc.com'; + const emailService = new EmailService({ + email: { + host: 'test', + port: 587, + secure: false, + smtpuser: '', + smtppass: '', + sender: 'noreply@getunleash.ai', + }, + getLogger: noLoggerProvider, + } as unknown as IUnleashConfig); + + const customerId = 'customer133'; + const environments = ['development', 'production']; + const content = await emailService.sendOrderEnvironmentEmail( + 'user@user.com', + customerId, + environments, + ); + expect(content.from).toBe('noreply@getunleash.ai'); + expect(content.subject).toBe('Unleash - ordered environments successfully'); + expect(content.html.includes(`
Hello,
-An order for additional environments has been successfully submitted by {{{ userEmail }}} for customer ID {{{ instanceId }}}. Below are the details of the environments requested:
+An order for additional environments has been successfully submitted by {{{ userEmail }}} for customer ID {{{ customerId }}}. Below are the details of the environments requested:
Please note that it may take up to 24 hours for these changes to come into effect.
diff --git a/src/mailtemplates/order-environments/order-environments.plain.mustache b/src/mailtemplates/order-environments/order-environments.plain.mustache index 2075f983a5..e12da06c27 100644 --- a/src/mailtemplates/order-environments/order-environments.plain.mustache +++ b/src/mailtemplates/order-environments/order-environments.plain.mustache @@ -2,10 +2,10 @@ Subject: Order for additional environments submitted Hello, -An order for additional environments has been successfully submitted by {{ userEmail }} for customer ID {{ instanceId }}. Below are the details of the environments requested: +An order for additional environments has been successfully submitted by {{ userEmail }} for customer ID {{ customerId }}. Below are the details of the environments requested: {{#environments}} - - {{ name }} + - {{.}} {{/environments}} Please note that it may take up to 24 hours for these changes to come into effect.