Skip to content

Commit

Permalink
feat(Send Email Node): Add content-id for email attachments (#3632)
Browse files Browse the repository at this point in the history
  • Loading branch information
pemontto committed May 19, 2023
1 parent e88b9d8 commit 8fe8aad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/nodes-base/nodes/EmailSend/v2/send.operation.ts
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

0 comments on commit 8fe8aad

Please sign in to comment.