mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 16:44:07 -08:00
87 lines
1.6 KiB
TypeScript
87 lines
1.6 KiB
TypeScript
import type {
|
|
IExecuteFunctions,
|
|
INodeExecutionData,
|
|
INodeType,
|
|
INodeTypeBaseDescription,
|
|
INodeTypeDescription,
|
|
} from 'n8n-workflow';
|
|
import { NodeConnectionType } from 'n8n-workflow';
|
|
|
|
import * as send from './send.operation';
|
|
|
|
const versionDescription: INodeTypeDescription = {
|
|
displayName: 'Send Email',
|
|
name: 'emailSend',
|
|
icon: 'fa:envelope',
|
|
group: ['output'],
|
|
version: [2, 2.1],
|
|
description: 'Sends an email using SMTP protocol',
|
|
defaults: {
|
|
name: 'Send Email',
|
|
color: '#00bb88',
|
|
},
|
|
inputs: [NodeConnectionType.Main],
|
|
outputs: [NodeConnectionType.Main],
|
|
usableAsTool: true,
|
|
credentials: [
|
|
{
|
|
name: 'smtp',
|
|
required: true,
|
|
testedBy: 'smtpConnectionTest',
|
|
},
|
|
],
|
|
properties: [
|
|
{
|
|
displayName: 'Resource',
|
|
name: 'resource',
|
|
type: 'hidden',
|
|
noDataExpression: true,
|
|
default: 'email',
|
|
options: [
|
|
{
|
|
name: 'Email',
|
|
value: 'email',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
displayName: 'Operation',
|
|
name: 'operation',
|
|
type: 'hidden',
|
|
noDataExpression: true,
|
|
default: 'send',
|
|
options: [
|
|
{
|
|
name: 'Send',
|
|
value: 'send',
|
|
action: 'Send an Email',
|
|
},
|
|
],
|
|
},
|
|
...send.description,
|
|
],
|
|
};
|
|
|
|
export class EmailSendV2 implements INodeType {
|
|
description: INodeTypeDescription;
|
|
|
|
constructor(baseDescription: INodeTypeBaseDescription) {
|
|
this.description = {
|
|
...baseDescription,
|
|
...versionDescription,
|
|
};
|
|
}
|
|
|
|
methods = {
|
|
credentialTest: { smtpConnectionTest: send.smtpConnectionTest },
|
|
};
|
|
|
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
let returnData: INodeExecutionData[][] = [];
|
|
|
|
returnData = await send.execute.call(this);
|
|
|
|
return returnData;
|
|
}
|
|
}
|