Neah/types/email.ts
2025-04-30 20:55:17 +02:00

53 lines
1.2 KiB
TypeScript

/**
* Standardized Email Interfaces
*
* This file contains the core interfaces for email data structures
* used throughout the application. All components should use these
* interfaces for consistency.
*/
export interface EmailAddress {
name: string;
address: string;
}
export interface EmailAttachment {
filename: string;
contentType: string;
content?: string;
size?: number;
contentId?: string;
}
export interface EmailContent {
html?: string; // HTML content if available
text: string; // Plain text (always present)
isHtml: boolean; // Flag to indicate primary content type
direction?: 'ltr'|'rtl' // Text direction
}
export interface EmailFlags {
seen: boolean;
flagged: boolean;
answered: boolean;
deleted: boolean;
draft: boolean;
}
export interface EmailMessage {
id: string;
messageId?: string;
uid?: number;
subject: string;
from: EmailAddress[];
to: EmailAddress[];
cc?: EmailAddress[];
bcc?: EmailAddress[];
date: Date | string;
flags: EmailFlags;
preview?: string;
content: EmailContent; // Standardized content structure
attachments: EmailAttachment[];
folder?: string;
size?: number;
}