feat(core): Adjust n8n email template styling (#19969)

This commit is contained in:
Juuso Tapaninen 2025-09-25 14:43:59 +03:00 committed by GitHub
parent 60560ba6d6
commit dbf328452c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 53 additions and 81 deletions

View File

@ -189,7 +189,7 @@ describe('UserManagementMailer', () => {
const callBody = nodeMailer.sendMail.mock.calls[index][0].body;
expect(callBody).toContain(
`You have been added to the ${project.name} project as ${sharee.role.replace('project:', '')}`,
`You have been added to the <b>${project.name}</b> project as ${sharee.role.replace('project:', '')}`,
);
});
});

View File

@ -1,20 +1,13 @@
<mj-head>
<mj-font name="Inter" href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap" />
<mj-attributes>
<mj-all align="left" font-family="Inter, Helvetica, Arial, sans-serif"></mj-all>
<mj-text
font-weight="400"
font-size="16px"
color="#444444"
line-height="24px"
></mj-text>
<mj-button
background-color="#ff6f5c"
color="#ffffff"
font-size="16px"
font-weight="500"
line-height="20px"
border-radius="5px"
></mj-button>
</mj-attributes>
<mj-attributes>
<mj-all font-family="Inter, Helvetica, Arial, sans-serif" color="#414244" line-height="1.5" />
<mj-body background-color="#ffffff" width="600px" />
<mj-section padding="0px" />
<mj-column padding="0px" />
<mj-text padding="8px 12px" font-size="16px" />
<mj-image padding="0px" />
<mj-button padding="20px 12px" background-color="#ff6f5c" color="#ffffff" inner-padding="8px 40px" border-radius="8px" align="left" font-size="16px" />
<mj-divider padding="10px 12px" border-color="#d9d9d9" border-width="1px" />
</mj-attributes>
</mj-head>

View File

@ -0,0 +1,7 @@
<mj-spacer height="24px" />
<mj-divider border-color="#d9d9d9" border-width="1px"/>
<mj-spacer height="16px" />
<mj-text font-size="14px" color="#909398" font-weight="300" >
n8n GmbH, Novalisstraße 10, 10115 Berlin, Germany<br />
©{{ currentYear }} n8n GmbH, all rights reserved<br />
</mj-text>

View File

@ -1,5 +1 @@
<mj-section>
<mj-column padding-left="15px">
<mj-image src="cid:n8n-logo" width="125px" padding="0" />
</mj-column>
</mj-section>
<mj-image src="cid:n8n-logo" href="https://n8n.io/" align="left" width="125px" alt="n8n" padding-top="20px" padding-bottom="40px" />

View File

@ -1,17 +1,14 @@
<mjml>
<mj-include path="./_common.mjml" />
<mj-body>
<mj-include path="./_logo.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="24px">A credential has been shared with you</mj-text>
</mj-column>
</mj-section>
<mj-section>
<mj-section padding="0 20px">
<mj-column>
<mj-include path="./_logo.mjml" />
<mj-text font-size="22px" font-weight="400">A credential has been shared with you</mj-text>
<mj-text><b>"{{ credentialsName }}"</b> credential has been shared with you.</mj-text>
<mj-text>To access it, please click the button below.</mj-text>
<mj-button href="{{credentialsListUrl}}">Open credential</mj-button>
<mj-include path="./_footer.mjml" />
</mj-column>
</mj-section>
</mj-body>

View File

@ -1,30 +1,18 @@
<mjml>
<mj-include path="./_common.mjml" />
<mj-body>
<mj-include path="./_logo.mjml" />
<mj-section>
<mj-section padding="0 20px">
<mj-column>
<mj-text font-size="24px">Reset your n8n password</mj-text>
</mj-column>
</mj-section>
<mj-section>
<mj-column>
<mj-text font-size="20px">Hi {{firstName}},</mj-text>
<mj-text>Somebody asked to reset your password on n8n at <b>{{domain}}</b> .</mj-text>
<mj-text> Click the following link to choose a new password. </mj-text>
<mj-include path="./_logo.mjml" />
<mj-text font-size="22px" font-weight="400">Reset your n8n password</mj-text>
<mj-text>Hi {{firstName}},</mj-text>
<mj-text>Somebody asked to reset your password on n8n at <b>{{domain}}</b>.</mj-text>
<mj-text>Click the following link to choose a new password.</mj-text>
<mj-button href="{{passwordResetUrl}}">Set a new password</mj-button>
<mj-text font-size="14px">
The link is only valid for 20 minutes since this email was sent.
</mj-text>
</mj-column>
</mj-section>
<mj-section>
<mj-column>
<mj-text>
If you did not request this email, you can safely ignore this. <br />
Your password will not be changed.
<mj-text font-size="14px" color="#909398" font-style="italic" font-weight="300">
The link is only valid for 20 minutes since this email was sent. If you did not request this email, you can safely ignore this. Your password will not be changed.
</mj-text>
<mj-include path="./_footer.mjml" />
</mj-column>
</mj-section>
</mj-body>

View File

@ -1,20 +1,15 @@
<mjml>
<mj-include path="./_common.mjml" />
<mj-body>
<mj-include path="./_logo.mjml" />
<mj-section>
<mj-section padding="0 20px">
<mj-column>
<mj-text font-size="24px"
>You have been added to the {{ projectName }} project as {{ role }}</mj-text
>
</mj-column>
</mj-section>
<mj-section>
<mj-column>
<mj-text
>This gives you access to all the workflows and credentials in that project</mj-text
>
<mj-include path="./_logo.mjml" />
<mj-text font-size="22px" font-weight="400">
You have been added to the <b>{{ projectName }}</b> project as {{ role }}
</mj-text>
<mj-text>This gives you access to all the workflows and credentials in that project.</mj-text>
<mj-button href="{{projectUrl}}">View project</mj-button>
<mj-include path="./_footer.mjml" />
</mj-column>
</mj-section>
</mj-body>

View File

@ -1,17 +1,14 @@
<mjml>
<mj-include path="./_common.mjml" />
<mj-body>
<mj-include path="./_logo.mjml" />
<mj-section>
<mj-section padding="0 20px">
<mj-column>
<mj-text font-size="24px">Welcome to n8n! 🎉</mj-text>
</mj-column>
</mj-section>
<mj-section>
<mj-column>
<mj-text>You have been invited to join n8n at <b>{{domain}}</b> .</mj-text>
<mj-include path="./_logo.mjml" />
<mj-text font-size="22px" font-weight="400">Welcome to n8n! 🎉</mj-text>
<mj-text>You have been invited to join n8n at <b>{{domain}}</b>.</mj-text>
<mj-text>To accept, please click the button below.</mj-text>
<mj-button padding-top="20px" href="{{inviteAcceptUrl}}">Set up your n8n account</mj-button>
<mj-button href="{{inviteAcceptUrl}}">Set up your n8n account</mj-button>
<mj-include path="./_footer.mjml" />
</mj-column>
</mj-section>
</mj-body>

View File

@ -1,17 +1,14 @@
<mjml>
<mj-include path="./_common.mjml" />
<mj-body>
<mj-include path="./_logo.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="24px">A workflow has been shared with you</mj-text>
</mj-column>
</mj-section>
<mj-section>
<mj-section padding="0 20px">
<mj-column>
<mj-include path="./_logo.mjml" />
<mj-text font-size="22px" font-weight="400">A workflow has been shared with you</mj-text>
<mj-text><b>"{{ workflowName }}"</b> workflow has been shared with you.</mj-text>
<mj-text>To access it, please click the button below.</mj-text>
<mj-button href="{{workflowUrl}}">Open Workflow</mj-button>
<mj-include path="./_footer.mjml" />
</mj-column>
</mj-section>
</mj-body>

View File

@ -102,7 +102,7 @@ export class UserManagementMailer {
return await this.mailer!.sendMail({
emailRecipients: recipient.email,
subject: subjectBuilder(),
body: populateTemplate(templateData),
body: populateTemplate({ ...this.basePayload, ...templateData }),
});
});
@ -245,6 +245,8 @@ export class UserManagementMailer {
private get basePayload() {
const baseUrl = this.urlService.getInstanceBaseUrl();
const domain = new URL(baseUrl).hostname;
return { baseUrl, domain };
const currentYear = new Date().getFullYear();
return { baseUrl, domain, currentYear };
}
}