n8n-nodes-imap-ai
Version:
Simplified IMAP node for n8n with AI-agent support. Clean and modular email and mailbox management for automation workflows.
51 lines (50 loc) • 1.19 kB
TypeScript
import { ImapFlow } from 'imapflow';
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
export interface IImapOperation {
execute(executeFunctions: IExecuteFunctions, client: ImapFlow, itemIndex: number): Promise<INodeExecutionData[] | any>;
}
export interface IEmailData {
uid: number;
subject: string;
from: any;
to: any[];
cc?: any[];
bcc?: any[];
date: Date | null;
text?: string;
html?: string;
attachments?: IAttachmentData[];
flags: Set<string>;
seen: boolean;
size?: number;
binaryAttachments?: IBinaryAttachment[];
}
export interface IBinaryAttachment {
filename: string;
contentType: string;
data: Buffer;
size: number;
}
export interface IAttachmentData {
filename?: string;
contentType: string;
size: number;
content?: string;
}
export interface IMailboxData {
name: string;
path: string;
delimiter: string;
flags: string[];
subscribed: boolean;
hasChildren: boolean;
noSelect: boolean;
}
export interface ISearchCriteria {
from?: string;
to?: string;
subject?: string;
text?: string;
since?: Date;
before?: Date;
}