Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smtpeshka

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smtpeshka - npm Package Compare versions

Comparing version 0.0.5 to 0.1.0

42

lib/Config.js

@@ -24,28 +24,26 @@ 'use strict';

},
smtpeshka: {
web: {
port: 2580
web: {
port: 2580
},
SMTP: {
port: 2525
},
transport: {
json: {
saveto: '<%= directory %>/sent-emails'
}
},
haraka: {
prog: {
dir: '<%= _libDirectory %>/node_modules/Haraka'
},
SMTP: {
port: 2525
},
transport: {
json: {
saveto: '<%= directory %>/sent-emails'
}
},
haraka: {
prog: {
dir: '<%= _libDirectory %>/node_modules/Haraka'
config: {
source: {
dir: '<%= _libDirectory %>/haraka-def'
},
config: {
source: {
dir: '<%= _libDirectory %>/haraka-def'
},
build: {
dir: '/tmp/smtpeshka/haraka'
}
build: {
dir: '/tmp/smtpeshka/haraka'
}
}
}
}

@@ -52,0 +50,0 @@ }

@@ -19,3 +19,3 @@ 'use strict';

var config = this.appConfig,
emailsDir = config.get('smtpeshka.transport.json.saveto'),
emailsDir = config.get('transport.json.saveto'),
emails = glob.sync(path.join(emailsDir, '*.json'));

@@ -22,0 +22,0 @@

@@ -18,7 +18,7 @@ 'use strict';

HarakaConfig.prototype.getBuildDir = function(){
return this.appConfig.get('smtpeshka.haraka.config.build.dir');
return this.appConfig.get('haraka.config.build.dir');
};
HarakaConfig.prototype.getSourceDir = function(){
return this.appConfig.get('smtpeshka.haraka.config.source.dir');
return this.appConfig.get('haraka.config.source.dir');
};

@@ -25,0 +25,0 @@

@@ -10,3 +10,3 @@ 'use strict';

var port = appConfig.get('smtpeshka.web.port', {
var port = appConfig.get('web.port', {
default: 2580

@@ -13,0 +13,0 @@ });

@@ -6,2 +6,14 @@ var express = require('express');

var getStatus = function(){
var config = treeConfig.instance();
return {
web: config.get('web'),
SMTP: config.get('SMTP'),
transport: config.get('transport'),
haraka: config.get('haraka')
};
};
router.get('/status', function(req, res, next){

@@ -13,3 +25,3 @@ var config = treeConfig.instance();

version: config.get('package.version'),
config: config.get('smtpeshka')
config: getStatus()
});

@@ -19,6 +31,6 @@ });

router.get('/api/status', function(req, res, next){
var config = treeConfig.instance();
res.json(config.get('smtpeshka'));
var status = getStatus();
res.json(status);
});
module.exports = router;
{
"name": "smtpeshka",
"description": "Virtual SMTP-server for debugging mail messages third-party applications",
"version": "0.0.5",
"version": "0.1.0",
"homepage": "https://github.com/abricos/smtpeshka",

@@ -6,0 +6,0 @@ "author": {

@@ -1,3 +0,5 @@

# smtpeshka
# smtpeshka [![Build Status](https://travis-ci.org/abricos/smtpeshka.svg?branch=master)](https://travis-ci.org/abricos/smtpeshka)
[![NPM](https://nodei.co/npm/smtpeshka.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/smtpeshka/)
Virtual SMTP-server for debugging mail messages third-party applications

@@ -12,2 +14,3 @@

## Installation
Installation is fairly straightforward, just install the npm module:

@@ -17,3 +20,160 @@

## Running smtpeshka
### Running smtpeshka
Create a project for to store your sent messages and config files.
$ mkdir my-smtp-test
$ cd my-smtp-test
$ smtpeshka
Now configure your mail application to send emails via SMTP:
SMTP host: localhost
SMTP port: 2525
Start your application with these settings and send any e-mail message.
Your message will not be sent to the address.
This message is saved in the folder `sent-emails` your project `my-smtp-test`.
## Web
Sent messages can be viewed in a browser at http://localhost:2580
## API
### GET localhost:2580/api
E-mail list
[
{
"html": <p>Hello World!</p>",
"text": "Hello World!",
"headers": {
"received": "from person.local (ip6-localhost [::1]) by Server ...",
"date": "Thu, 22 Jan 2015 23:09:13 +0300",
"to": "user@example.com",
"from": "E-mail Tester <>",
"subject": "Hello",
"message-id": "5684b0c0bd9a38962535083a3d5c79dc",
"x-priority": "normal"
},
"subject": "Hello",
"messageId": "5684b0c0bd9a38962535083a3d5c79dc",
"priority": "normal",
"from": [
{
"address": "info@localhost",
"name": "Local Server"
}
],
"to": [
{
"address": "user@example.com",
"name": "User"
}
],
"date": "2015-01-22T20:09:13.000Z"
}
]
### GET localhost:2580/api/email/:messageId
E-mail by message-id
{
"html": <p>Hello World!</p>",
"text": "Hello World!",
"headers": {
"received": "from person.local (ip6-localhost [::1]) by Server ...",
"date": "Thu, 22 Jan 2015 23:09:13 +0300",
"to": "user@example.com",
"from": "E-mail Tester <>",
"subject": "Hello",
"message-id": "5684b0c0bd9a38962535083a3d5c79dc",
"x-priority": "normal"
},
"subject": "Hello",
"messageId": "5684b0c0bd9a38962535083a3d5c79dc",
"priority": "normal",
"from": [
{
"address": "info@localhost",
"name": "Local Server"
}
],
"to": [
{
"address": "user@example.com",
"name": "User"
}
],
"date": "2015-01-22T20:09:13.000Z"
}
### GET localhost:2580/api/status
Status SMTPeshka
{
"web": {
"port": 2580
},
"SMTP": {
"port": 2525
},
"transport": {
"json": {
"saveto": "/home/user/my-smtp-test/sent-emails"
}
},
"haraka": {
"prog": {
"dir": "/usr/local/lib/node_modules/smtpeshka/node_modules/Haraka"
},
"config": {
"source": {
"dir": "/usr/local/lib/node_modules/smtpeshka/haraka-def"
},
"build": {
"dir": "/tmp/smtpeshka/haraka"
}
}
}
}
## Configuration
SMTPeshka can be configured using JSON in a `smtpeshka.json` in directory run the SMTPehska.
For example:
"log": {
"console": {
"level": "debug"
}
},
"web": {
"port": 12580
},
"SMTP": {
"port": 12525
},
"transport": {
"json": {
"saveto": "<%= directory %>/my-emails"
}
},
"haraka": {
"config": {
"build": {
"dir": "<%= directory %>/tmp"
}
}
}
## License
MIT

@@ -42,3 +42,3 @@ 'use strict';

it('should be sended e-mail', function(done){
var port = config.get('smtpeshka.SMTP.port');
var port = config.get('SMTP.port');

@@ -63,3 +63,3 @@ var transporter = nodemailer.createTransport(smtpTransport({

var sentDir = config.get('smtpeshka.transport.json.saveto');
var sentDir = config.get('transport.json.saveto');
var file = path.join(sentDir, messageId + '.json');

@@ -92,3 +92,3 @@ var fExist = fs.existsSync(file);

var port = config.get('smtpeshka.web.port');
var port = config.get('web.port');
var host = 'localhost';

@@ -113,3 +113,3 @@ var uri = 'http://' + host + ':' + port + '/api';

var port = config.get('smtpeshka.web.port');
var port = config.get('web.port');
var host = 'localhost';

@@ -135,3 +135,3 @@ var uri = 'http://' + host + ':' + port + '/api/email/' + messageId;

var port = config.get('smtpeshka.web.port');
var port = config.get('web.port');
var host = 'localhost';

@@ -138,0 +138,0 @@ var uri = 'http://' + host + ':' + port + '/api/status';

@@ -35,3 +35,3 @@ 'use strict';

var buildDir = appConfig.get('smtpeshka.haraka.config.build.dir');
var buildDir = appConfig.get('haraka.config.build.dir');
should(buildDir).be.type('string');

@@ -38,0 +38,0 @@

@@ -27,4 +27,4 @@ 'use strict';

it('option `smtpeshka.haraka.prog.dir` (dir exist)', function(done){
var option = config.get('smtpeshka.haraka.prog.dir');
it('option `haraka.prog.dir` (dir exist)', function(done){
var option = config.get('haraka.prog.dir');

@@ -39,4 +39,4 @@ should(option).be.type('string');

it('option `smtpeshka.haraka.config.source.dir` (dir exist)', function(done){
var option = config.get('smtpeshka.haraka.config.source.dir');
it('option `haraka.config.source.dir` (dir exist)', function(done){
var option = config.get('haraka.config.source.dir');

@@ -43,0 +43,0 @@ should(option).be.type('string');

@@ -18,5 +18,6 @@ 'use strict';

config.set('log.console.level', 'warn');
config.set('temp.dir', tempDir);
config.set('smtpeshka.transport.json.saveto', path.join(tempDir, 'sent-emails'));
config.set('smtpeshka.haraka.config.build.dir', path.join(tempDir, 'haraka'));
config.set('web.port', 12580);
config.set('SMTP.port', 12525);
config.set('transport.json.saveto', path.join(tempDir, 'sent-emails'));
config.set('haraka.config.build.dir', path.join(tempDir, 'haraka'));

@@ -23,0 +24,0 @@ return config;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc