mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-26 14:15:57 +08:00
smtp-server: definitions for v3.3 (#20661)
* Type definitions for smtp-server 3.3 * Older version 1 must have a path mapping for itself * DATA stream is Readable * `err` argument for callbacks is optional if there is no other arg
This commit is contained in:
committed by
Sheetal Nandi
parent
7fabe51f9a
commit
692d55bf9f
675
types/smtp-server/index.d.ts
vendored
675
types/smtp-server/index.d.ts
vendored
@@ -1,386 +1,317 @@
|
||||
// Type definitions for smtp-server v1.15.0
|
||||
// Project: https://github.com/andris9/smtp-server
|
||||
// Type definitions for smtp-server 3.3
|
||||
// Project: https://github.com/nodemailer/smtp-server
|
||||
// Definitions by: markisme <https://github.com/markisme>
|
||||
// taisiias <https://github.com/Taisiias>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Piotr Roszatycki <https://github.com/dex4er>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference types="nodemailer" />
|
||||
|
||||
/// <reference types="node"/>
|
||||
import { EventEmitter } from 'events';
|
||||
import * as net from 'net';
|
||||
import * as shared from 'nodemailer/lib/shared';
|
||||
import { Readable } from 'stream';
|
||||
import * as tls from 'tls';
|
||||
|
||||
export class SMTPServer extends EventEmitter {
|
||||
constructor(options: SMTPServerOptions);
|
||||
close(callback: (err?: Error) => any): any;
|
||||
listen(...args: any[]): void;
|
||||
onAuth(auth: Authentication, session: Session, callback: any): any;
|
||||
onClose(callback: (err?: Error) => any): any;
|
||||
onConnect(session: Session, callback: (err?: Error) => any): any;
|
||||
onData(stream: any, session: Session, callback: (err?: Error) => any): any;
|
||||
onMailFrom(address: Address, session: Session, callback: (err?: Error) => any): any;
|
||||
onRcptTo(address: Address, session: Session, callback: (err?: Error) => any): any;
|
||||
}
|
||||
export type ms = number;
|
||||
|
||||
export interface SMTPServerOptions {
|
||||
/**
|
||||
* if true, the connection will use TLS. The default is false.
|
||||
* If the server doesn't start in TLS mode,
|
||||
* it is still possible to upgrade clear text socket to
|
||||
* TLS socket with the STARTTLS command (unless you disable support for it).
|
||||
* If secure is true, additional tls options for tls.
|
||||
* createServer can be added directly onto this options object.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
secure?: boolean;
|
||||
key?: any;
|
||||
cert?: any;
|
||||
ca?: any;
|
||||
/**
|
||||
* optional hostname of the server,
|
||||
* used for identifying to the client (defaults to os.hostname())
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* optional greeting message.
|
||||
* This message is appended to the default ESMTP response.
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
banner?: string;
|
||||
/**
|
||||
* optional maximum allowed message size in bytes,
|
||||
* see details:https://github.com/andris9/smtp-server#using-size-extension
|
||||
*
|
||||
* @type {number}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* optional array of allowed authentication methods, defaults to ['PLAIN', 'LOGIN'].
|
||||
* Only the methods listed in this array are allowed,
|
||||
* so if you set it to ['XOAUTH2'] then PLAIN and LOGIN are not available.
|
||||
* Use ['PLAIN', 'LOGIN', 'XOAUTH2'] to allow all three.
|
||||
* Authentication is only allowed in secure mode
|
||||
* (either the server is started with secure: true option or STARTTLS command is used)
|
||||
*
|
||||
* @type {string[]}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
authMethods?: string[];
|
||||
/**
|
||||
* allow authentication, but do not require it
|
||||
*
|
||||
* @type {*}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
authOptional?: any;
|
||||
/**
|
||||
* optional array of disabled commands (see all supported commands here).
|
||||
* For example if you want to disable authentication,
|
||||
* use ['AUTH'] as this value.
|
||||
* If you want to allow authentication in clear text, set it to ['STARTTLS'].
|
||||
*
|
||||
* @type {*}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
disabledCommands?: string[];
|
||||
/**
|
||||
* optional boolean, if set to true then allow using STARTTLS
|
||||
* but do not advertise or require it. It only makes sense
|
||||
* when creating integration test servers for testing the scenario
|
||||
* where you want to try STARTTLS even when it is not advertised
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
hideSTARTTLS?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show PIPELINING in feature list
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
hidePIPELINING?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show 8BITMIME in features list
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
hide8BITMIME?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show SMTPUTF8 in features list
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
hideSMTPUTF8?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true allows authentication even if connection is not secured first
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
allowInsecureAuth?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not try to reverse resolve client hostname
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
disableReverseLookup?: boolean;
|
||||
/**
|
||||
* optional Map or an object of TLS options for SNI where servername is the key. Overrided by SNICallback.
|
||||
*
|
||||
* @type {Object}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
sniOptions?: Object;
|
||||
/**
|
||||
* optional bunyan compatible logger instance.
|
||||
* If set to true then logs to console.
|
||||
* If value is not set or is false then nothing is logged
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
logger?: boolean;
|
||||
/**
|
||||
* sets the maximum number of concurrently connected clients, defaults to Infinity
|
||||
*
|
||||
* @type {number}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
maxClients?: number;//defaults to Infinity
|
||||
/**
|
||||
* boolean, if set to true expects to be behind a proxy that emits a
|
||||
* PROXY header{http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt} (version 1 only)
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
useProxy?: boolean;
|
||||
/**
|
||||
* boolean, if set to true, enables usage of
|
||||
* XCLIENT{http://www.postfix.org/XCLIENT_README.html} extension to override connection properties.
|
||||
* See session.xClient (Map object) for the details provided by the client
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
useXClient?: boolean;
|
||||
/**
|
||||
* boolean, if set to true, enables usage of XFORWARD{http://www.postfix.org/XFORWARD_README.html} extension.
|
||||
* See session.xForward (Map object) for the details provided by the client
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
useXForward?: boolean;
|
||||
/**
|
||||
* boolean, if set to true use LMTP protocol instead of SMTP
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
lmtp?: boolean;
|
||||
/**
|
||||
* How many milliseconds of inactivity to allow before disconnecting the client (defaults to 1 minute)
|
||||
*
|
||||
* @type {number}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
socketTimeout?: number;//millisceonds
|
||||
/**
|
||||
* How many millisceonds to wait before disconnecting pending
|
||||
* connections once server.close() has been called (defaults to 30 seconds)
|
||||
*
|
||||
* @type {number}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
closeTimeout?: number;//millisceonds
|
||||
/**
|
||||
* The callback to handle authentications (see details https://github.com/andris9/smtp-server#handling-authentication)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onAuth?: (auth: Authentication, session: Session, callback: (err?: Error, response?: AuthenticationResponse) => any) => any;
|
||||
/**
|
||||
* The callback to handle the client connection. (see details https://github.com/andris9/smtp-server#validating-client-connection)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onConnect?: (session: Session, callback: (err?: Error) => any) => any;
|
||||
/**
|
||||
* the callback to validate MAIL FROM commands (see details https://github.com/andris9/smtp-server#validating-sender-addresses)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onMailFrom?: (address: Address, session: Session, callback: (err?: Error) => any) => any;
|
||||
/**
|
||||
* The callback to validate RCPT TO commands (see details https://github.com/andris9/smtp-server#validating-recipient-addresses)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onRcptTo?: (address: Address, session: Session, callback: (err?: Error) => any) => any;
|
||||
/**
|
||||
* the callback to handle incoming messages (see details https://github.com/andris9/smtp-server#processing-incoming-message)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onData?: (stream: any, session: Session, callback: (err?: Error) => any) => any;
|
||||
/**
|
||||
* the callback that informs about closed client connection
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onClose?: (session: Session) => any;
|
||||
}
|
||||
|
||||
export interface Authentication {
|
||||
/**
|
||||
* indicates the authentication method used, 'PLAIN', 'LOGIN' or 'XOAUTH2'
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
method: "PLAIN" | "LOGIN" | "XOAUTH2";//'PLAIN', 'LOGIN' or 'XOAUTH2'
|
||||
/**
|
||||
* the username of the user
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* the password if LOGIN or PLAIN was used
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* the OAuth2 bearer access token if 'XOAUTH2' was used as the authentication method
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
accessToken?: string;
|
||||
/**
|
||||
* a function for validating CRAM-MD5 challenge responses.
|
||||
* Takes the password of the user as an argument and returns true if the response matches the password
|
||||
*
|
||||
*
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
validatePassword: (password: string) => boolean;
|
||||
}
|
||||
|
||||
export interface AuthenticationResponse {
|
||||
/**
|
||||
* can be any value - if this is set then the user is considered logged in
|
||||
* and this value is used later with the session data to identify the user.
|
||||
* If this value is empty, then the authentication is considered failed
|
||||
*
|
||||
* @type {*}
|
||||
* @memberOf AuthenticationResponse
|
||||
*/
|
||||
user: any;
|
||||
/**
|
||||
* an object to return if XOAUTH2 authentication failed (do not set the error object in this case).
|
||||
* This value is serialized to JSON and base64 encoded automatically, so you can just return the object
|
||||
*
|
||||
* @type {{}}
|
||||
* @memberOf AuthenticationResponse
|
||||
*/
|
||||
data?: {};
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
/**
|
||||
* random string identificator generated when the client connected
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Session
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* the IP address for the connected client
|
||||
*
|
||||
* @type {Address}
|
||||
* @memberOf Session
|
||||
*/
|
||||
remoteAddress: Address;
|
||||
/**
|
||||
* reverse resolved hostname for remoteAddress
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Session
|
||||
*/
|
||||
clientHostname: string;
|
||||
/**
|
||||
* the opening SMTP command (HELO/EHLO/LHLO)
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Session
|
||||
*/
|
||||
openingCommand: string;
|
||||
/**
|
||||
* hostname the client provided with HELO/EHLO call
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Session
|
||||
*/
|
||||
hostNameApearsAs: string;
|
||||
/**
|
||||
* Envelope Object
|
||||
*
|
||||
* @type {Envelope}
|
||||
* @memberOf Session
|
||||
*/
|
||||
envelope: Envelope;
|
||||
}
|
||||
|
||||
export interface Envelope {
|
||||
/**
|
||||
* includes an address object or is set to false
|
||||
*
|
||||
* @type {Address}
|
||||
* @memberOf Envelope
|
||||
*/
|
||||
mailFrom: Address;
|
||||
/**
|
||||
* includes an array of address objects
|
||||
*
|
||||
* @type {Address[]}
|
||||
* @memberOf Envelope
|
||||
*/
|
||||
rcptTo: Address[];
|
||||
}
|
||||
|
||||
export interface Address {
|
||||
export interface SMTPServerAddress {
|
||||
/**
|
||||
* the address provided with the MAIL FROM or RCPT TO command
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Address
|
||||
*/
|
||||
address: string;
|
||||
/**
|
||||
* an object with additional arguments (all key names are uppercase)
|
||||
*
|
||||
* @type {Object}
|
||||
* @memberOf Address
|
||||
*/
|
||||
args: Object;
|
||||
args: object;
|
||||
}
|
||||
|
||||
export interface SMTPServerAuthentication {
|
||||
/**
|
||||
* indicates the authentication method used, 'PLAIN', 'LOGIN' or 'XOAUTH2'
|
||||
*/
|
||||
method: 'PLAIN' | 'LOGIN' | 'XOAUTH2';
|
||||
/**
|
||||
* the username of the user
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* the password if LOGIN or PLAIN was used
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* the OAuth2 bearer access token if 'XOAUTH2' was used as the authentication method
|
||||
*/
|
||||
accessToken?: string;
|
||||
/**
|
||||
* a function for validating CRAM-MD5 challenge responses.
|
||||
* Takes the password of the user as an argument and returns true if the response matches the password
|
||||
*/
|
||||
validatePassword(password: string): boolean;
|
||||
}
|
||||
|
||||
export interface SMTPServerAuthenticationResponse {
|
||||
/**
|
||||
* can be any value - if this is set then the user is considered logged in
|
||||
* and this value is used later with the session data to identify the user.
|
||||
* If this value is empty, then the authentication is considered failed
|
||||
*/
|
||||
user: any;
|
||||
/**
|
||||
* an object to return if XOAUTH2 authentication failed (do not set the error object in this case).
|
||||
* This value is serialized to JSON and base64 encoded automatically, so you can just return the object
|
||||
*/
|
||||
data?: object;
|
||||
}
|
||||
|
||||
export interface SMTPServerSession {
|
||||
/**
|
||||
* random string identificator generated when the client connected
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* the IP address for the connected client
|
||||
*/
|
||||
remoteAddress: SMTPServerAddress;
|
||||
/**
|
||||
* reverse resolved hostname for remoteAddress
|
||||
*/
|
||||
clientHostname: string;
|
||||
/**
|
||||
* the opening SMTP command (HELO/EHLO/LHLO)
|
||||
*/
|
||||
openingCommand: string;
|
||||
/**
|
||||
* hostname the client provided with HELO/EHLO call
|
||||
*/
|
||||
hostNameAppearsAs: string;
|
||||
/**
|
||||
* Envelope Object
|
||||
*/
|
||||
envelope: SMTPServerEnvelope;
|
||||
transmissionType: string;
|
||||
|
||||
tlsOptions: tls.TlsOptions;
|
||||
}
|
||||
|
||||
export interface SMTPServerEnvelope {
|
||||
/**
|
||||
* includes an address object or is set to false
|
||||
*/
|
||||
mailFrom: SMTPServerAddress;
|
||||
/**
|
||||
* includes an array of address objects
|
||||
*/
|
||||
rcptTo: SMTPServerAddress[];
|
||||
}
|
||||
|
||||
export interface SMTPServerOptions extends tls.TlsOptions {
|
||||
/**
|
||||
* if true, the connection will use TLS. The default is false.
|
||||
* If the server doesn't start in TLS mode,
|
||||
* it is still possible to upgrade clear text socket to
|
||||
* TLS socket with the STARTTLS command (unless you disable support for it).
|
||||
* If secure is true, additional tls options for tls.
|
||||
* createServer can be added directly onto this options object.
|
||||
*/
|
||||
secure?: boolean;
|
||||
/** optional private keys in PEM format */
|
||||
key?: string | string[] | Buffer | Buffer[] | Array<{ pem: string | Buffer, passphrase: string }>;
|
||||
/** optional cert chains in PEM format */
|
||||
cert?: string | string[] | Buffer | Buffer[];
|
||||
/** optionally override the trusted CA certificates */
|
||||
ca?: string | string[] | Buffer | Buffer[];
|
||||
/**
|
||||
* optional hostname of the server,
|
||||
* used for identifying to the client (defaults to os.hostname())
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* optional greeting message.
|
||||
* This message is appended to the default ESMTP response.
|
||||
*/
|
||||
banner?: string;
|
||||
/**
|
||||
* optional maximum allowed message size in bytes,
|
||||
* see details:https://github.com/andris9/smtp-server#using-size-extension
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* optional array of allowed authentication methods, defaults to ['PLAIN', 'LOGIN'].
|
||||
* Only the methods listed in this array are allowed,
|
||||
* so if you set it to ['XOAUTH2'] then PLAIN and LOGIN are not available.
|
||||
* Use ['PLAIN', 'LOGIN', 'XOAUTH2'] to allow all three.
|
||||
* Authentication is only allowed in secure mode
|
||||
* (either the server is started with secure: true option or STARTTLS command is used)
|
||||
*/
|
||||
authMethods?: string[];
|
||||
/**
|
||||
* allow authentication, but do not require it
|
||||
*/
|
||||
authOptional?: boolean;
|
||||
/**
|
||||
* optional array of disabled commands (see all supported commands here).
|
||||
* For example if you want to disable authentication,
|
||||
* use ['AUTH'] as this value.
|
||||
* If you want to allow authentication in clear text, set it to ['STARTTLS'].
|
||||
*/
|
||||
disabledCommands?: string[]; // TODO ('AUTH' | 'STARTTLS' | 'XCLIENT' | 'XFORWARD')[];
|
||||
/**
|
||||
* optional boolean, if set to true then allow using STARTTLS
|
||||
* but do not advertise or require it. It only makes sense
|
||||
* when creating integration test servers for testing the scenario
|
||||
* where you want to try STARTTLS even when it is not advertised
|
||||
*/
|
||||
hideSTARTTLS?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show PIPELINING in feature list
|
||||
*/
|
||||
hidePIPELINING?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show 8BITMIME in features list
|
||||
*/
|
||||
hide8BITMIME?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show SMTPUTF8 in features list
|
||||
*/
|
||||
hideSMTPUTF8?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true allows authentication even if connection is not secured first
|
||||
*/
|
||||
allowInsecureAuth?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not try to reverse resolve client hostname
|
||||
*/
|
||||
disableReverseLookup?: boolean;
|
||||
/**
|
||||
* optional Map or an object of TLS options for SNI where servername is the key. Overrided by SNICallback.
|
||||
*/
|
||||
sniOptions?: { [servername: string]: tls.TlsOptions } | Map<string, tls.TlsOptions>;
|
||||
/**
|
||||
* optional boolean, if set to true then upgrade sockets to TLS immediately after connection is established. Works with secure: true
|
||||
*/
|
||||
needsUpgrade?: boolean;
|
||||
/**
|
||||
* optional bunyan compatible logger instance.
|
||||
* If set to true then logs to console.
|
||||
* If value is not set or is false then nothing is logged
|
||||
*/
|
||||
logger?: shared.Logger | boolean;
|
||||
/**
|
||||
* sets the maximum number of concurrently connected clients, defaults to Infinity
|
||||
*/
|
||||
maxClients?: number;
|
||||
/**
|
||||
* boolean, if set to true expects to be behind a proxy that emits a
|
||||
* PROXY header{http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt} (version 1 only)
|
||||
*/
|
||||
useProxy?: boolean;
|
||||
/**
|
||||
* boolean, if set to true, enables usage of
|
||||
* XCLIENT{http://www.postfix.org/XCLIENT_README.html} extension to override connection properties.
|
||||
* See session.xClient (Map object) for the details provided by the client
|
||||
*/
|
||||
useXClient?: boolean;
|
||||
/**
|
||||
* boolean, if set to true, enables usage of XFORWARD{http://www.postfix.org/XFORWARD_README.html} extension.
|
||||
* See session.xForward (Map object) for the details provided by the client
|
||||
*/
|
||||
useXForward?: boolean;
|
||||
/**
|
||||
* boolean, if set to true use LMTP protocol instead of SMTP
|
||||
*/
|
||||
lmtp?: boolean;
|
||||
/**
|
||||
* How many milliseconds of inactivity to allow before disconnecting the client (defaults to 1 minute)
|
||||
*/
|
||||
socketTimeout?: ms;
|
||||
/**
|
||||
* How many millisceonds to wait before disconnecting pending
|
||||
* connections once server.close() has been called (defaults to 30 seconds)
|
||||
*/
|
||||
closeTimeout?: ms;
|
||||
/**
|
||||
* The callback to handle authentications (see details https://github.com/andris9/smtp-server#handling-authentication)
|
||||
*/
|
||||
onAuth?(auth: SMTPServerAuthentication, session: SMTPServerSession, callback: (err: Error | null | undefined, response: SMTPServerAuthenticationResponse) => void): void;
|
||||
/**
|
||||
* The callback to handle the client connection. (see details https://github.com/andris9/smtp-server#validating-client-connection)
|
||||
*/
|
||||
onConnect?(session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
/**
|
||||
* the callback to validate MAIL FROM commands (see details https://github.com/andris9/smtp-server#validating-sender-addresses)
|
||||
*/
|
||||
onMailFrom?(address: SMTPServerAddress, session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
/**
|
||||
* The callback to validate RCPT TO commands (see details https://github.com/andris9/smtp-server#validating-recipient-addresses)
|
||||
*/
|
||||
onRcptTo?(address: SMTPServerAddress, session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
/**
|
||||
* the callback to handle incoming messages (see details https://github.com/andris9/smtp-server#processing-incoming-message)
|
||||
*/
|
||||
onData?(stream: Readable, session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
/**
|
||||
* the callback that informs about closed client connection
|
||||
*/
|
||||
onClose?(session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
}
|
||||
|
||||
/** Creates a SMTP server instance */
|
||||
export class SMTPServer extends EventEmitter {
|
||||
options: SMTPServerOptions;
|
||||
logger: shared.Logger;
|
||||
secureContext: Map<string, tls.SecureContext>;
|
||||
connections: Set<any>;
|
||||
server: net.Server;
|
||||
|
||||
constructor(options?: SMTPServerOptions);
|
||||
|
||||
/** Start listening on selected port and interface */
|
||||
/* tslint:disable:unified-signatures */
|
||||
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): net.Server;
|
||||
listen(port?: number, hostname?: string, listeningListener?: () => void): net.Server;
|
||||
listen(port?: number, backlog?: number, listeningListener?: () => void): net.Server;
|
||||
listen(port?: number, listeningListener?: () => void): net.Server;
|
||||
listen(path: string, backlog?: number, listeningListener?: () => void): net.Server;
|
||||
listen(path: string, listeningListener?: () => void): void;
|
||||
listen(options: net.ListenOptions, listeningListener?: () => void): net.Server;
|
||||
listen(handle: any, backlog?: number, listeningListener?: () => void): net.Server;
|
||||
listen(handle: any, listeningListener?: () => void): net.Server;
|
||||
/* tslint:enable:unified-signatures */
|
||||
|
||||
/** Closes the server */
|
||||
close(callback: (err?: Error | null) => void): void;
|
||||
|
||||
updateSecureContext(options: tls.TlsOptions): void;
|
||||
|
||||
/** Authentication handler. Override this */
|
||||
onAuth(auth: SMTPServerAuthentication, session: SMTPServerSession, callback: (err: Error | null | undefined, response: SMTPServerAuthenticationResponse) => void): void;
|
||||
onClose(session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
onConnect(session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
onData(stream: Readable, session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
onMailFrom(address: SMTPServerAddress, session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
onRcptTo(address: SMTPServerAddress, session: SMTPServerSession, callback: (err?: Error | null) => void): void;
|
||||
|
||||
addListener(event: 'close', listener: () => void): this;
|
||||
addListener(event: 'error', listener: (err: Error) => void): this;
|
||||
|
||||
emit(event: 'close'): boolean;
|
||||
emit(event: 'error', err: Error): boolean;
|
||||
|
||||
on(event: 'close', listener: () => void): this;
|
||||
on(event: 'error', listener: (err: Error) => void): this;
|
||||
|
||||
once(event: 'close', listener: () => void): this;
|
||||
once(event: 'error', listener: (err: Error) => void): this;
|
||||
|
||||
prependListener(event: 'close', listener: () => void): this;
|
||||
prependListener(event: 'error', listener: (err: Error) => void): this;
|
||||
|
||||
prependOnceListener(event: 'close', listener: () => void): this;
|
||||
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
||||
|
||||
listeners(event: 'close'): Array<() => void>;
|
||||
listeners(event: 'error'): Array<(err: Error) => void>;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,75 @@
|
||||
import { SMTPServer, SMTPServerOptions } from 'smtp-server';
|
||||
import { SMTPServer, SMTPServerAddress, SMTPServerAuthentication, SMTPServerAuthenticationResponse, SMTPServerOptions, SMTPServerSession } from 'smtp-server';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
function SMTPServerConnectTest() {
|
||||
let options: SMTPServerOptions = {
|
||||
secure: false,
|
||||
};
|
||||
let server = new SMTPServer(options);
|
||||
server.on('error', err => {
|
||||
console.log('Error %s', err.message);
|
||||
});
|
||||
server.listen(2323);
|
||||
const options: SMTPServerOptions = {
|
||||
hideSTARTTLS: true,
|
||||
onConnect,
|
||||
onMailFrom,
|
||||
onRcptTo,
|
||||
onData,
|
||||
onClose,
|
||||
port: 2525
|
||||
};
|
||||
|
||||
function onConnect(session: SMTPServerSession, callback: (err?: Error) => void): void {
|
||||
console.log(`[${session.id}] onConnect`);
|
||||
callback();
|
||||
}
|
||||
|
||||
SMTPServerConnectTest();
|
||||
function onAuth(auth: SMTPServerAuthentication, session: SMTPServerSession, callback: (err: Error | undefined, response?: SMTPServerAuthenticationResponse) => void): void {
|
||||
if (auth.method === 'PLAIN' && auth.username === 'username' && auth.password === 'password') {
|
||||
callback(undefined, { user: auth.username });
|
||||
} else {
|
||||
callback(new Error('Invalid username or password'));
|
||||
}
|
||||
}
|
||||
|
||||
function onMailFrom(from: SMTPServerAddress, session: SMTPServerSession, callback: (err?: Error) => void): void {
|
||||
console.log(`[${session.id}] onMailFrom ${from.address}`);
|
||||
if (from.address.split('@')[1] === 'spammer.com') {
|
||||
// code 421 disconnects SMTP session immediately
|
||||
callback(Object.assign(new Error('we do not like spam!'), { responseCode: 421 }));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
function onRcptTo(to: SMTPServerAddress, session: SMTPServerSession, callback: (err?: Error) => void): void {
|
||||
console.log(`[${session.id}] onRcptTo ${to.address}`);
|
||||
callback();
|
||||
}
|
||||
|
||||
function onData(stream: Readable, session: SMTPServerSession, callback: (err?: Error) => void): void {
|
||||
console.log(`[${session.id}] onData started`);
|
||||
|
||||
let messageLength = 0;
|
||||
|
||||
stream.on('data', (chunk: Buffer) => {
|
||||
console.log(`[${session.id}] onData got data chunk ${chunk.length} bytes`);
|
||||
messageLength += chunk.length;
|
||||
});
|
||||
|
||||
stream.once('end', () => {
|
||||
console.log(`[${session.id}] onData finished after reading ${messageLength} bytes`);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
function onClose(session: SMTPServerSession) {
|
||||
console.log(`[${session.id}] onClose`);
|
||||
}
|
||||
|
||||
const server = new SMTPServer(options);
|
||||
|
||||
server.on('error', (err) => {
|
||||
console.log(`Server got error:`, err);
|
||||
});
|
||||
|
||||
server.on('close', () => {
|
||||
console.log('Server closed');
|
||||
});
|
||||
|
||||
server.listen(options.port, () => {
|
||||
const address = server.server.address();
|
||||
console.log(`Listening on [${address.address}]:${address.port}`);
|
||||
});
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
3
types/smtp-server/tslint.json
Normal file
3
types/smtp-server/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
386
types/smtp-server/v1/index.d.ts
vendored
Normal file
386
types/smtp-server/v1/index.d.ts
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
// Type definitions for smtp-server v1.15.0
|
||||
// Project: https://github.com/andris9/smtp-server
|
||||
// Definitions by: markisme <https://github.com/markisme>
|
||||
// taisiias <https://github.com/Taisiias>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export class SMTPServer extends EventEmitter {
|
||||
constructor(options: SMTPServerOptions);
|
||||
close(callback: (err?: Error) => any): any;
|
||||
listen(...args: any[]): void;
|
||||
onAuth(auth: Authentication, session: Session, callback: any): any;
|
||||
onClose(callback: (err?: Error) => any): any;
|
||||
onConnect(session: Session, callback: (err?: Error) => any): any;
|
||||
onData(stream: any, session: Session, callback: (err?: Error) => any): any;
|
||||
onMailFrom(address: Address, session: Session, callback: (err?: Error) => any): any;
|
||||
onRcptTo(address: Address, session: Session, callback: (err?: Error) => any): any;
|
||||
}
|
||||
|
||||
export interface SMTPServerOptions {
|
||||
/**
|
||||
* if true, the connection will use TLS. The default is false.
|
||||
* If the server doesn't start in TLS mode,
|
||||
* it is still possible to upgrade clear text socket to
|
||||
* TLS socket with the STARTTLS command (unless you disable support for it).
|
||||
* If secure is true, additional tls options for tls.
|
||||
* createServer can be added directly onto this options object.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
secure?: boolean;
|
||||
key?: any;
|
||||
cert?: any;
|
||||
ca?: any;
|
||||
/**
|
||||
* optional hostname of the server,
|
||||
* used for identifying to the client (defaults to os.hostname())
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* optional greeting message.
|
||||
* This message is appended to the default ESMTP response.
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
banner?: string;
|
||||
/**
|
||||
* optional maximum allowed message size in bytes,
|
||||
* see details:https://github.com/andris9/smtp-server#using-size-extension
|
||||
*
|
||||
* @type {number}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* optional array of allowed authentication methods, defaults to ['PLAIN', 'LOGIN'].
|
||||
* Only the methods listed in this array are allowed,
|
||||
* so if you set it to ['XOAUTH2'] then PLAIN and LOGIN are not available.
|
||||
* Use ['PLAIN', 'LOGIN', 'XOAUTH2'] to allow all three.
|
||||
* Authentication is only allowed in secure mode
|
||||
* (either the server is started with secure: true option or STARTTLS command is used)
|
||||
*
|
||||
* @type {string[]}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
authMethods?: string[];
|
||||
/**
|
||||
* allow authentication, but do not require it
|
||||
*
|
||||
* @type {*}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
authOptional?: any;
|
||||
/**
|
||||
* optional array of disabled commands (see all supported commands here).
|
||||
* For example if you want to disable authentication,
|
||||
* use ['AUTH'] as this value.
|
||||
* If you want to allow authentication in clear text, set it to ['STARTTLS'].
|
||||
*
|
||||
* @type {*}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
disabledCommands?: string[];
|
||||
/**
|
||||
* optional boolean, if set to true then allow using STARTTLS
|
||||
* but do not advertise or require it. It only makes sense
|
||||
* when creating integration test servers for testing the scenario
|
||||
* where you want to try STARTTLS even when it is not advertised
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
hideSTARTTLS?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show PIPELINING in feature list
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
hidePIPELINING?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show 8BITMIME in features list
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
hide8BITMIME?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not show SMTPUTF8 in features list
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
hideSMTPUTF8?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true allows authentication even if connection is not secured first
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
allowInsecureAuth?: boolean;
|
||||
/**
|
||||
* optional boolean, if set to true then does not try to reverse resolve client hostname
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
disableReverseLookup?: boolean;
|
||||
/**
|
||||
* optional Map or an object of TLS options for SNI where servername is the key. Overrided by SNICallback.
|
||||
*
|
||||
* @type {Object}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
sniOptions?: Object;
|
||||
/**
|
||||
* optional bunyan compatible logger instance.
|
||||
* If set to true then logs to console.
|
||||
* If value is not set or is false then nothing is logged
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
logger?: boolean;
|
||||
/**
|
||||
* sets the maximum number of concurrently connected clients, defaults to Infinity
|
||||
*
|
||||
* @type {number}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
maxClients?: number;//defaults to Infinity
|
||||
/**
|
||||
* boolean, if set to true expects to be behind a proxy that emits a
|
||||
* PROXY header{http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt} (version 1 only)
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
useProxy?: boolean;
|
||||
/**
|
||||
* boolean, if set to true, enables usage of
|
||||
* XCLIENT{http://www.postfix.org/XCLIENT_README.html} extension to override connection properties.
|
||||
* See session.xClient (Map object) for the details provided by the client
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
useXClient?: boolean;
|
||||
/**
|
||||
* boolean, if set to true, enables usage of XFORWARD{http://www.postfix.org/XFORWARD_README.html} extension.
|
||||
* See session.xForward (Map object) for the details provided by the client
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
useXForward?: boolean;
|
||||
/**
|
||||
* boolean, if set to true use LMTP protocol instead of SMTP
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
lmtp?: boolean;
|
||||
/**
|
||||
* How many milliseconds of inactivity to allow before disconnecting the client (defaults to 1 minute)
|
||||
*
|
||||
* @type {number}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
socketTimeout?: number;//millisceonds
|
||||
/**
|
||||
* How many millisceonds to wait before disconnecting pending
|
||||
* connections once server.close() has been called (defaults to 30 seconds)
|
||||
*
|
||||
* @type {number}
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
closeTimeout?: number;//millisceonds
|
||||
/**
|
||||
* The callback to handle authentications (see details https://github.com/andris9/smtp-server#handling-authentication)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onAuth?: (auth: Authentication, session: Session, callback: (err?: Error, response?: AuthenticationResponse) => any) => any;
|
||||
/**
|
||||
* The callback to handle the client connection. (see details https://github.com/andris9/smtp-server#validating-client-connection)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onConnect?: (session: Session, callback: (err?: Error) => any) => any;
|
||||
/**
|
||||
* the callback to validate MAIL FROM commands (see details https://github.com/andris9/smtp-server#validating-sender-addresses)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onMailFrom?: (address: Address, session: Session, callback: (err?: Error) => any) => any;
|
||||
/**
|
||||
* The callback to validate RCPT TO commands (see details https://github.com/andris9/smtp-server#validating-recipient-addresses)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onRcptTo?: (address: Address, session: Session, callback: (err?: Error) => any) => any;
|
||||
/**
|
||||
* the callback to handle incoming messages (see details https://github.com/andris9/smtp-server#processing-incoming-message)
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onData?: (stream: any, session: Session, callback: (err?: Error) => any) => any;
|
||||
/**
|
||||
* the callback that informs about closed client connection
|
||||
*
|
||||
*
|
||||
* @memberOf SMTPServerOptions
|
||||
*/
|
||||
onClose?: (session: Session) => any;
|
||||
}
|
||||
|
||||
export interface Authentication {
|
||||
/**
|
||||
* indicates the authentication method used, 'PLAIN', 'LOGIN' or 'XOAUTH2'
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
method: "PLAIN" | "LOGIN" | "XOAUTH2";//'PLAIN', 'LOGIN' or 'XOAUTH2'
|
||||
/**
|
||||
* the username of the user
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* the password if LOGIN or PLAIN was used
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* the OAuth2 bearer access token if 'XOAUTH2' was used as the authentication method
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
accessToken?: string;
|
||||
/**
|
||||
* a function for validating CRAM-MD5 challenge responses.
|
||||
* Takes the password of the user as an argument and returns true if the response matches the password
|
||||
*
|
||||
*
|
||||
* @memberOf Authentication
|
||||
*/
|
||||
validatePassword: (password: string) => boolean;
|
||||
}
|
||||
|
||||
export interface AuthenticationResponse {
|
||||
/**
|
||||
* can be any value - if this is set then the user is considered logged in
|
||||
* and this value is used later with the session data to identify the user.
|
||||
* If this value is empty, then the authentication is considered failed
|
||||
*
|
||||
* @type {*}
|
||||
* @memberOf AuthenticationResponse
|
||||
*/
|
||||
user: any;
|
||||
/**
|
||||
* an object to return if XOAUTH2 authentication failed (do not set the error object in this case).
|
||||
* This value is serialized to JSON and base64 encoded automatically, so you can just return the object
|
||||
*
|
||||
* @type {{}}
|
||||
* @memberOf AuthenticationResponse
|
||||
*/
|
||||
data?: {};
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
/**
|
||||
* random string identificator generated when the client connected
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Session
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* the IP address for the connected client
|
||||
*
|
||||
* @type {Address}
|
||||
* @memberOf Session
|
||||
*/
|
||||
remoteAddress: Address;
|
||||
/**
|
||||
* reverse resolved hostname for remoteAddress
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Session
|
||||
*/
|
||||
clientHostname: string;
|
||||
/**
|
||||
* the opening SMTP command (HELO/EHLO/LHLO)
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Session
|
||||
*/
|
||||
openingCommand: string;
|
||||
/**
|
||||
* hostname the client provided with HELO/EHLO call
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Session
|
||||
*/
|
||||
hostNameApearsAs: string;
|
||||
/**
|
||||
* Envelope Object
|
||||
*
|
||||
* @type {Envelope}
|
||||
* @memberOf Session
|
||||
*/
|
||||
envelope: Envelope;
|
||||
}
|
||||
|
||||
export interface Envelope {
|
||||
/**
|
||||
* includes an address object or is set to false
|
||||
*
|
||||
* @type {Address}
|
||||
* @memberOf Envelope
|
||||
*/
|
||||
mailFrom: Address;
|
||||
/**
|
||||
* includes an array of address objects
|
||||
*
|
||||
* @type {Address[]}
|
||||
* @memberOf Envelope
|
||||
*/
|
||||
rcptTo: Address[];
|
||||
}
|
||||
|
||||
export interface Address {
|
||||
/**
|
||||
* the address provided with the MAIL FROM or RCPT TO command
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Address
|
||||
*/
|
||||
address: string;
|
||||
/**
|
||||
* an object with additional arguments (all key names are uppercase)
|
||||
*
|
||||
* @type {Object}
|
||||
* @memberOf Address
|
||||
*/
|
||||
args: Object;
|
||||
}
|
||||
15
types/smtp-server/v1/smtp-server-tests.ts
Normal file
15
types/smtp-server/v1/smtp-server-tests.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { SMTPServer, SMTPServerOptions } from 'smtp-server';
|
||||
|
||||
function SMTPServerConnectTest() {
|
||||
let options: SMTPServerOptions = {
|
||||
secure: false,
|
||||
};
|
||||
let server = new SMTPServer(options);
|
||||
server.on('error', err => {
|
||||
console.log('Error %s', err.message);
|
||||
});
|
||||
server.listen(2323);
|
||||
}
|
||||
|
||||
SMTPServerConnectTest();
|
||||
|
||||
28
types/smtp-server/v1/tsconfig.json
Normal file
28
types/smtp-server/v1/tsconfig.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"smtp-server": [
|
||||
"smtp-server/v1"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"smtp-server-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user