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