Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Send Email Node): Add content-id for email attachments #3632

Merged
merged 5 commits into from
May 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/nodes-base/nodes/EmailSend/v2/send.operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import type {
IExecuteFunctions,
INodeExecutionData,
INodeProperties,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';

import { createTransport } from 'nodemailer';
import type SMTPTransport from 'nodemailer/lib/smtp-transport';
Expand Down Expand Up @@ -100,7 +102,7 @@ const properties: INodeProperties[] = [
type: 'string',
default: '',
description:
'Name of the binary properties that contain data to add to email as attachment. Multiple ones can be comma-separated.',
'Name of the binary properties that contain data to add to email as attachment. Multiple ones can be comma-separated. Reference embedded images or other content within the body of an email message, e.g. <img src="cid:image_1">',
},
{
displayName: 'CC Email',
Expand Down Expand Up @@ -227,6 +229,7 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
attachments.push({
filename: binaryData.fileName || 'unknown',
content: await this.helpers.getBinaryDataBuffer(itemIndex, propertyName),
cid: propertyName,
});
}

Expand Down Expand Up @@ -255,7 +258,8 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
});
continue;
}
throw error;
delete error.cert;
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}

Expand Down