Remove executeSingle from EmailSend node

This commit is contained in:
dali 2021-02-16 07:23:37 +01:00
parent caad6d1c8d
commit 46d1a5fe58

View file

@ -1,6 +1,6 @@
import { import {
BINARY_ENCODING, BINARY_ENCODING,
IExecuteSingleFunctions, IExecuteFunctions
} from 'n8n-core'; } from 'n8n-core';
import { import {
IDataObject, IDataObject,
@ -124,18 +124,26 @@ export class EmailSend implements INodeType {
}; };
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> { async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const item = this.getInputData(); const items = this.getInputData();
const fromEmail = this.getNodeParameter('fromEmail') as string; const returnData: INodeExecutionData[] = [];
const toEmail = this.getNodeParameter('toEmail') as string; const length = items.length as unknown as number;
const ccEmail = this.getNodeParameter('ccEmail') as string; let item: INodeExecutionData;
const bccEmail = this.getNodeParameter('bccEmail') as string;
const subject = this.getNodeParameter('subject') as string; for (let itemIndex = 0; itemIndex < length; itemIndex++) {
const text = this.getNodeParameter('text') as string;
const html = this.getNodeParameter('html') as string; item = items[itemIndex];
const attachmentPropertyString = this.getNodeParameter('attachments') as string; console.log(item,itemIndex)
const options = this.getNodeParameter('options', {}) as IDataObject; const fromEmail = this.getNodeParameter('fromEmail', itemIndex) as string;
const toEmail = this.getNodeParameter('toEmail', itemIndex) as string;
const ccEmail = this.getNodeParameter('ccEmail', itemIndex) as string;
const bccEmail = this.getNodeParameter('bccEmail', itemIndex) as string;
const subject = this.getNodeParameter('subject', itemIndex) as string;
const text = this.getNodeParameter('text', itemIndex) as string;
const html = this.getNodeParameter('html', itemIndex) as string;
const attachmentPropertyString = this.getNodeParameter('attachments', itemIndex) as string;
const options = this.getNodeParameter('options', itemIndex, {}) as IDataObject;
const credentials = this.getCredentials('smtp'); const credentials = this.getCredentials('smtp');
@ -201,7 +209,10 @@ export class EmailSend implements INodeType {
// Send the email // Send the email
const info = await transporter.sendMail(mailOptions); const info = await transporter.sendMail(mailOptions);
return { json: info }; returnData.push({ json: info });
}
return this.prepareOutputData(returnData);
} }
} }