mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 21:07:28 -08:00
feat(Send Email Node): Add content-id for email attachments (#3632)
This commit is contained in:
parent
e88b9d880a
commit
8fe8aad6a7
|
@ -3,7 +3,9 @@ import type {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodeProperties,
|
INodeProperties,
|
||||||
|
JsonObject,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
import { NodeApiError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { createTransport } from 'nodemailer';
|
import { createTransport } from 'nodemailer';
|
||||||
import type SMTPTransport from 'nodemailer/lib/smtp-transport';
|
import type SMTPTransport from 'nodemailer/lib/smtp-transport';
|
||||||
|
@ -100,7 +102,7 @@ const properties: INodeProperties[] = [
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description:
|
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',
|
displayName: 'CC Email',
|
||||||
|
@ -227,6 +229,7 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
||||||
attachments.push({
|
attachments.push({
|
||||||
filename: binaryData.fileName || 'unknown',
|
filename: binaryData.fileName || 'unknown',
|
||||||
content: await this.helpers.getBinaryDataBuffer(itemIndex, propertyName),
|
content: await this.helpers.getBinaryDataBuffer(itemIndex, propertyName),
|
||||||
|
cid: propertyName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +258,8 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
delete error.cert;
|
||||||
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue