From 88261809efcf2a66bd2b39787a95978199fdb450 Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 16 Feb 2017 15:48:30 +0100 Subject: [PATCH] extended documentation (readme) --- README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++------- package.json | 2 +- 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 83dbdbd..27589ba 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,22 @@ # smtp-dump -NodeJS SMTP Server that dumps all received mails +This tool provides a Node.js SMTP Server that dumps all received mails to disk. It can be used to test SMTP Clients or +simulate SMTP Servers for Development reasons. -## Install +## Installation After cloning the repository npm install -## Use +## Usage node smtp-dump.js -smtp-dump.js will output all received E-Mails into the output folder (default _"output"_) while running. +smtp-dump.js will write out all E-Mails into the specified output folder (default `./output`) while running. +The SMTP Server does not require a username and/or a password. Also secure connections are not possible, yet. -### Arguments +### optional Arguments -Specify the logging destination by passing a path to _--output_ (default directory is _"output"_). +Specify the logging destination by passing a path to `--output` (default directory is `output`). Creates the directory if it does not exist. node smtp-dump.js --output=dump @@ -22,10 +24,63 @@ Creates the directory if it does not exist. node smtp-dump.js --output=C:\smtp-dump -Specify the port for the SMTP Server by passing a number (1 - 65536) to _--port_ (default Port is _25_) +Specify the port for the SMTP Server by passing a number (1 - 65536) to `--port` (default Port is `25`) node smtp-dump.js --port=dump -Debugging ouput (console) is enabled if you use _--logger_ +Debugging ouput (console) is enabled if you use `--logger` (default is disabled). - node smtp-dump.js --logger \ No newline at end of file + node smtp-dump.js --logger + +# Example + +Start smtp-dump.js with output directory `./dump`, port `10025` and logging activated. + + node smtp-dump.js --output=dump --port=10025 --logger + +Now enter the settings to your SMTP Server in your SMTP Client Application (usually on `localhost`). As soon as the client +tries to send an E-Mail using the specified SMTP Server the smtp-dump.js writes the Mail as a txt-File into the specified +output directory: + + Message-ID: <823a882740c0361723b9951939d501ee8347@example.com> + Date: Thu, 29 Dec 2016 15:54:13 +0100 + Subject: Test E-Mail + From: Test Client + To: test@example.com + MIME-Version: 1.0 + Content-Type: text/plain; charset=utf-8 + Content-Transfer-Encoding: quoted-printable + + This is a Test Message + +Since we used `--logger` the smtp-dump.js outputs some information to the command line: + + [2017-02-16 14:34:54] INFO: SMTP Server listening on [::]:10025 + [2017-02-16 14:35:46] INFO: [82Suh8w7238+O] Connection from [127.0.0.1] + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 220 localhost ESMTP + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: EHLO example.com + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 250-localhost Nice to meet you, [127.0.0.1] + 250-PIPELINING + 250-8BITMIME + 250-SMTPUTF8 + 250-AUTH LOGIN PLAIN + 250 STARTTLS + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: MAIL FROM: + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 250 Accepted + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: RCPT TO: + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 250 Accepted + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: DATA + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 354 End data with . + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: <701 bytes of DATA> + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 250 OK: message queued + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: MAIL FROM: + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 250 Accepted + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: RCPT TO: + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 250 Accepted + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: DATA + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 354 End data with . + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: <706 bytes of DATA> + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 250 OK: message queued + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] C: QUIT + [2017-02-16 14:35:46] DEBUG: [82Suh8w7238+O] S: 221 Bye + [2017-02-16 14:35:46] INFO: [82Suh8w7238+O] Connection closed to [127.0.0.1] diff --git a/package.json b/package.json index 2fdf4d9..8fa5e07 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "smtp-dump", "version": "0.0.2", - "description": "SMTP Server that outputs all receiving mails", + "description": "SMTP Server that dumps all receiving mails to disk", "main": "smtp-dump.js", "scripts": { "start": "node smtp-dump.js",