mirror of
https://github.com/eleith/emailjs.git
synced 2024-07-05 20:10:37 +00:00
smtp: add Connection to bare SMTP object names
This commit is contained in:
parent
106e5bab8f
commit
42a632af6a
@ -1,8 +1,8 @@
|
||||
import addressparser from 'addressparser';
|
||||
import { Message } from './message';
|
||||
import type { MessageAttachment, MessageHeaders } from './message'; // eslint-disable-line no-unused-vars
|
||||
import { SMTP, SMTPState } from './smtp';
|
||||
import type { SMTPOptions } from './smtp'; // eslint-disable-line no-unused-vars
|
||||
import { SMTPConnection, SMTPState } from './smtp';
|
||||
import type { SMTPConnectionOptions } from './smtp'; // eslint-disable-line no-unused-vars
|
||||
|
||||
export interface MessageStack {
|
||||
callback: (error: Error | null, message: Message) => void;
|
||||
@ -17,7 +17,7 @@ export interface MessageStack {
|
||||
}
|
||||
|
||||
export class Client {
|
||||
public smtp: SMTP;
|
||||
public smtp: SMTPConnection;
|
||||
public queue: MessageStack[] = [];
|
||||
public timer: NodeJS.Timer | null = null;
|
||||
public sending = false;
|
||||
@ -26,8 +26,8 @@ export class Client {
|
||||
/**
|
||||
* @param {*} server smtp options
|
||||
*/
|
||||
constructor(server: Partial<SMTPOptions>) {
|
||||
this.smtp = new SMTP(server);
|
||||
constructor(server: Partial<SMTPConnectionOptions>) {
|
||||
this.smtp = new SMTPConnection(server);
|
||||
//this.smtp.debug(1);
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ export interface SMTPSocketOptions {
|
||||
cert: string;
|
||||
}
|
||||
|
||||
export interface SMTPOptions {
|
||||
export interface SMTPConnectionOptions {
|
||||
timeout: number | null;
|
||||
user: string;
|
||||
password: string;
|
||||
@ -90,7 +90,7 @@ export interface ConnectOptions {
|
||||
ssl?: boolean;
|
||||
}
|
||||
|
||||
export class SMTP extends EventEmitter {
|
||||
export class SMTPConnection extends EventEmitter {
|
||||
private _state: 0 | 1 | 2 = SMTPState.NOTCONNECTED;
|
||||
private _secure = false;
|
||||
|
||||
@ -124,7 +124,7 @@ export class SMTP extends EventEmitter {
|
||||
tls,
|
||||
logger,
|
||||
authentication,
|
||||
}: Partial<SMTPOptions> = {}) {
|
||||
}: Partial<SMTPConnectionOptions> = {}) {
|
||||
super();
|
||||
|
||||
this.authentication = Array.isArray(authentication)
|
||||
|
Loading…
Reference in New Issue
Block a user