mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): Add "Sent by n8n" attribution (#7183)
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
This commit is contained in:
@@ -435,19 +435,43 @@ export function prepareEmailsInput(
|
||||
export function prepareEmailBody(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
itemIndex: number,
|
||||
appendAttribution = false,
|
||||
instanceId?: string,
|
||||
) {
|
||||
const emailType = this.getNodeParameter('emailType', itemIndex) as string;
|
||||
let message = (this.getNodeParameter('message', itemIndex, '') as string).trim();
|
||||
|
||||
let body = '';
|
||||
let htmlBody = '';
|
||||
|
||||
if (emailType === 'html') {
|
||||
htmlBody = (this.getNodeParameter('message', itemIndex, '') as string).trim();
|
||||
} else {
|
||||
body = (this.getNodeParameter('message', itemIndex, '') as string).trim();
|
||||
if (appendAttribution) {
|
||||
const attributionText = 'This email was sent automatically with ';
|
||||
const link = `https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=${encodeURIComponent(
|
||||
'n8n-nodes-base.gmail',
|
||||
)}${instanceId ? '_' + instanceId : ''}`;
|
||||
if (emailType === 'html') {
|
||||
message = `
|
||||
${message}
|
||||
<br>
|
||||
<br>
|
||||
---
|
||||
<br>
|
||||
<em>${attributionText}<a href="${link}" target="_blank">n8n</a></em>
|
||||
`;
|
||||
} else {
|
||||
message = `${message}\n\n---\n${attributionText}n8n\n${'https://n8n.io'}`;
|
||||
}
|
||||
}
|
||||
|
||||
return { body, htmlBody };
|
||||
const body = {
|
||||
body: '',
|
||||
htmlBody: '',
|
||||
};
|
||||
|
||||
if (emailType === 'html') {
|
||||
body.htmlBody = message;
|
||||
} else {
|
||||
body.body = message;
|
||||
}
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
export async function prepareEmailAttachments(
|
||||
|
||||
Reference in New Issue
Block a user