@softkit/mail
Version:
The Mailgun Mail Module is a comprehensive solution for integrating Mailgun's email functionality into NestJS applications. It provides a seamless way to send emails using Mailgun with minimal setup and configuration.
40 lines (39 loc) • 1.35 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { MessageContentDto } from './message-content.dto';
import { Readable } from 'node:stream';
import type { AtLeastOneKeyPresent } from 'mailgun.js';
export declare class AttachmentFile {
filename: string;
type?: string;
contentId?: string;
disposition?: string;
data: string | Buffer | Readable | Uint8Array;
}
export declare class SendEmailDto {
from?: string;
userFullName?: string;
cc?: string[];
bcc?: string[];
to: string | string[];
subject?: string;
/**
* **Important:** You must use `multipart/form-data` encoding when sending attachments.
*/
attachment?: AttachmentFile[];
/**
* This type definition allows the passing of various Mailgun-specific parameters
* The Mailgun API expects dynamic parameters with specific prefixes, such as:
* - 'o:' for options (e.g., 'o:testmode' to enable test mode)
* - 'v:' for custom JSON data (e.g., 'v:my-var' for custom variables)
* - 'h:' for custom headers (e.g., 'h:X-My-Header' for custom MIME headers)
*/
[key: string]: unknown;
}
export interface SendEmailResult {
id?: string;
message?: string;
status: number;
details?: string;
}
export type EmailDataType = SendEmailDto & AtLeastOneKeyPresent<MessageContentDto>;