<commit_before># simplesmtp

This is a module to easily create custom SMTP servers and clients - use SMTP as a first class protocol in Node.JS!

[![Build Status](https://secure.travis-ci.org/andris9/simplesmtp.png)](http://travis-ci.org/andris9/simplesmtp)

[Autogenerated docs](http://node.ee/smtpdoc/)

## SMTP Server

### Usage

Create a new SMTP server instance with

    var smtp = simplesmtp.createServer([options]);
    
And start listening on selected port

    smtp.listen(25, [function(err){}]);
    
SMTP options can include the following:

  * **name** - the hostname of the server, will be used for informational messages
  * **debug** - if set to true, print out messages about the connection
  * **timeout** - client timeout in milliseconds, defaults to 60 000 (60 sec.)
  * **secureConnection** - start a server on secure connection
  * **SMTPBanner** - greeting banner that is sent to the client on connection
  * **requireAuthentication** - if set to true, require that the client must authenticate itself
  * **validateSender** - if set to true, emit `'validateSender'` with `email` and `callback` when the client enters `MAIL FROM:<address>`
  * **validateRecipients** - if set to true, emit `'validateRecipient'` with `email` and `callback` when the client enters `RCPT TO:<address>`
  * **maxSize** - maximum size of an e-mail in bytes (currently informational only)
  * **credentials** - TLS credentials (`{key:'', cert:'', ca:''}`) for the server
  * **authMethods** - allowed authentication methods, defaults to `["PLAIN", "LOGIN"]`
  * **disableEHLO** - if set to true, support HELO command only
  
### Example

    var simplesmtp = require("simplesmtp"),
        fs = require("fs");

    var smtp = simplesmtp.createServer();
    smtp.listen(25);

    smtp.on("startData", function(envelope){<commit_msg>fixed a bug in readme<commit_after># simplesmtp

This is a module to easily create custom SMTP servers and clients - use SMTP as a first class protocol in Node.JS!

[![Build Status](https://secure.travis-ci.org/andris9/simplesmtp.png)](http://travis-ci.org/andris9/simplesmtp)

[Autogenerated docs](http://node.ee/smtpdoc/)

## SMTP Server

### Usage

Create a new SMTP server instance with

    var smtp = simplesmtp.createServer([options]);
    
And start listening on selected port

    smtp.listen(25, [function(err){}]);
    
SMTP options can include the following:

  * **name** - the hostname of the server, will be used for informational messages
  * **debug** - if set to true, print out messages about the connection
  * **timeout** - client timeout in milliseconds, defaults to 60 000 (60 sec.)
  * **secureConnection** - start a server on secure connection
  * **SMTPBanner** - greeting banner that is sent to the client on connection
  * **requireAuthentication** - if set to true, require that the client must authenticate itself
  * **validateSender** - if set to true, emit `'validateSender'` with `email` and `callback` when the client enters `MAIL FROM:<address>`
  * **validateRecipients** - if set to true, emit `'validateRecipient'` with `email` and `callback` when the client enters `RCPT TO:<address>`
  * **maxSize** - maximum size of an e-mail in bytes (currently informational only)
  * **credentials** - TLS credentials (`{key:'', cert:'', ca:['']}`) for the server
  * **authMethods** - allowed authentication methods, defaults to `["PLAIN", "LOGIN"]`
  * **disableEHLO** - if set to true, support HELO command only
  
### Example

    var simplesmtp = require("simplesmtp"),
        fs = require("fs");

    var smtp = simplesmtp.createServer();
    smtp.listen(25);

    smtp.on("startData", function(envelope){
{'fraction_non_alphanumeric': 0.12908496732026145, 'fraction_numerical': 0.007080610021786492, 'mean_word_length': 4.165963431786216, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4678668', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1074, 'n_words': 405}