lib/smtp-pool.js
function SMTPPool(options) {
    EventEmitter.call(this);

    options = options || {};
    if (typeof options === 'string') {
        options = {
            url: options
        };
    }

    var urlData;
    var service = options.service;

    if (typeof options.getSocket === 'function') {
        this.getSocket = options.getSocket;
    }

    if (options.url) {
        urlData = shared.parseConnectionUrl(options.url);
        service = service || urlData.service;
    }

    this.options = assign(
        false, // create new object
        options, // regular options
        urlData, // url options
        service && wellknown(service) // wellknown options
    );

    this.options.maxConnections = this.options.maxConnections || 5;
    this.options.maxMessages = this.options.maxMessages || 100;

    this.logger = this.options.logger = shared.getLogger(this.options);

    // temporary object
    var connection = new SMTPConnection(this.options);

    this.name = 'SMTP (pool)';
    this.version = packageData.version + '[client:' + connection.version + ']';

    this._rateLimit = {
        counter: 0,
        timeout: null,
        waiting: [],
        checkpoint: false
    };
    this._closed = false;
    this._queue = [];
    this._connections = [];
    this._connectionCounter = 0;

    this.idling = true;

    setImmediate(function () {
        if (this.idling) {
            this.emit('idle');
        }
    }.bind(this));
}
function SMTPPool(options) {
    EventEmitter.call(this);

    options = options || {};
    if (typeof options === 'string') {
        options = {
            url: options
        };
    }

    var urlData;
    var service = options.service;

    if (typeof options.getSocket === 'function') {
        this.getSocket = options.getSocket;
    }

    if (options.url) {
        urlData = shared.parseConnectionUrl(options.url);
        service = service || urlData.service;
    }

    this.options = assign(
        false, // create new object
        options, // regular options
        urlData, // url options
        service && wellknown(service) // wellknown options
    );

    this.options.maxConnections = this.options.maxConnections || 5;
    this.options.maxMessages = this.options.maxMessages || 100;

    this.logger = this.options.logger = shared.getLogger(this.options);

    // temporary object
    var connection = new SMTPConnection(this.options);

    this.name = 'SMTP (pool)';
    this.version = packageData.version + '[client:' + connection.version + ']';

    this._rateLimit = {
        counter: 0,
        timeout: null,
        waiting: [],
        checkpoint: false
    };
    this._closed = false;
    this._queue = [];
    this._connections = [];
    this._connectionCounter = 0;

    this.idling = true;

    setImmediate(function () {
        if (this.idling) {
            this.emit('idle');
        }
    }.bind(this));
}
function SMTPPool ( options ) { EventEmitter . call ( this ) ; options = options || { } ; if ( typeof options === 'string' ) { options = { url : options } ; } var urlData ; var service = options . service ; if ( typeof options . getSocket === 'function' ) { this . getSocket = options . getSocket ; } if ( options . url ) { urlData = shared . parseConnectionUrl ( options . url ) ; service = service || urlData . service ; } this . options = assign ( false , // create new object options , // regular options urlData , // url options service && wellknown ( service ) // wellknown options ) ; this . options . maxConnections = this . options . maxConnections || 5 ; this . options . maxMessages = this . options . maxMessages || 100 ; this . logger = this . options . logger = shared . getLogger ( this . options ) ; // temporary object var connection = new SMTPConnection ( this . options ) ; this . name = 'SMTP (pool)' ; this . version = packageData . version + '[client:' + connection . version + ']' ; this . _rateLimit = { counter : 0 , timeout : null , waiting : [ ] , checkpoint : false } ; this . _closed = false ; this . _queue = [ ] ; this . _connections = [ ] ; this . _connectionCounter = 0 ; this . idling = true ; setImmediate ( function ( ) { if ( this . idling ) { this . emit ( 'idle' ) ; } } . bind ( this ) ) ; }
Creates a SMTP pool transport object for Nodemailer

@constructor
@param {Object} options SMTP Connection options
Creates a SMTP pool transport object for Nodemailer