maildove
Version:
Send emails using Node.js only
54 lines (53 loc) • 1.75 kB
TypeScript
import { Options } from 'nodemailer/lib/mailer';
interface MXRecord {
exchange: string;
priority: number;
}
interface tlsInterface {
key: string;
cert: string;
}
interface MailDoveOptions {
smtpPort?: number;
smtpHost?: string;
dkimEnabled?: boolean;
dkimPrivateKey?: string;
dkimKeySelector?: string;
startTLS?: boolean;
rejectUnauthorized?: boolean;
tls?: tlsInterface;
}
declare class MailDove {
smtpPort: number;
smtpHost?: string;
dkimEnabled: boolean;
dkimPrivateKey: string;
dkimKeySelector: string;
startTLS: boolean;
rejectUnauthorized: boolean;
tls: tlsInterface;
private step;
private queue;
private upgraded;
private isUpgradeInProgress;
private sock;
constructor(options: MailDoveOptions);
/**
* Resolve MX records by domain.
* @param {string} domain
* @returns {Promise<MXRecord[]>}
*/
resolveMX(domain: string): Promise<MXRecord[]>;
sendToSMTP(domain: string, srcHost: string, from: string, recipients: string[], body: string): Promise<string>;
writeToSocket: (s: string, domain: string) => void;
parseInputAndRespond(line: string, domain: string, srcHost: string, body: string, connectedExchange: string, resolve: any): void;
handleResponse(code: number, msg: string, domain: string, srcHost: string, body: string, connectedExchange: string, resolve: any): void;
/**
* Send Mail directly
* @param mail Mail object containing message, to/from etc.
* Complete attributes reference: https://nodemailer.com/extras/mailcomposer/#e-mail-message-fields
* @returns {Promise<string[]>}
*/
sendmail(mail: Options): Promise<string[]>;
}
export { MailDove };