@454creative/easy-email
Version:
A framework-agnostic email service library for Node.js with observability and monitoring
90 lines • 1.91 kB
TypeScript
/**
* Core email request interface
* This is framework-agnostic and can be used by any application
*/
export interface EmailRequest {
/**
* Recipient email address
*/
to: string | string[];
/**
* Email subject line
*/
subject: string;
/**
* Plain text content (optional if html is provided)
*/
text?: string;
/**
* HTML content (optional if text is provided)
*/
html?: string;
/**
* Sender email address
*/
from?: string;
/**
* CC recipients
*/
cc?: string | string[];
/**
* BCC recipients
*/
bcc?: string | string[];
/**
* Reply-to email address
*/
replyTo?: string;
/**
* Email attachments
*/
attachments?: EmailRequestAttachment[];
/**
* Custom headers
*/
headers?: Record<string, string>;
}
/**
* Email attachment interface for requests
*/
export interface EmailRequestAttachment {
filename: string;
content: Buffer | string;
contentType?: string;
encoding?: string;
path?: string;
}
/**
* Email response interface for requests
*/
export interface EmailRequestResponse {
success: boolean;
messageId?: string;
error?: {
message: string;
code: string;
provider?: string;
details?: {
rejected?: string[];
accepted?: string[];
smtpResponse?: string;
sendgridResponse?: any;
sesResponse?: any;
errorType?: string;
statusCode?: number;
suggestion?: string;
sendgridError?: any;
headers?: any;
rawError?: any;
};
};
}
/**
* Email validation result
*/
export interface EmailValidationResult {
isValid: boolean;
errors: string[];
suggestions?: string[];
}
//# sourceMappingURL=email-request.interface.d.ts.map