post_office 0.3.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +27 -9
- data/VERSION +1 -1
- data/bin/post_office +13 -10
- data/lib/config_file.rb +24 -0
- data/lib/smtp_server.rb +1 -0
- data/post_office.gemspec +11 -23
- metadata +27 -51
- data/pkg/post_office-0.1.0.gem +0 -0
- data/pkg/post_office-0.2.0.gem +0 -0
- data/pkg/post_office-0.2.1.gem +0 -0
- data/pkg/post_office-0.3.0.gem +0 -0
- data/pkg/post_office-0.3.1.gem +0 -0
- data/pkg/post_office-0.3.2.gem +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 001b4221494a9b862799ff8504e1afef46aa13a7
|
4
|
+
data.tar.gz: 1316fcae06e020835a7f80f27d3c5ecccdfcc09d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 46f635e7b67e0914b8123a93ecc45b982ab60bbd806794f87d736559638597f394b7febe9c999db0b5aec6b40c2bdfd621348f138e868206fe1946efe0b760f7
|
7
|
+
data.tar.gz: db714f92ba8a29083f349442824781ca75691441986dd280645dc10dc99ff1325bd64ab4f6a99660ef74a4e3240d9993ac07550d26927830821cfc1c86db8e66
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2011-2013 LICO Innovations
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
PostOffice mock SMTP/POP3 server
|
2
2
|
================================
|
3
3
|
|
4
|
-
https://github.com/bluerail/post_office
|
5
|
-
|
6
|
-
By Rene van Lieshout <rene@bluerail.nl>
|
7
|
-
|
8
|
-
Description
|
9
|
-
-----------
|
10
|
-
|
11
4
|
PostOffice is a mock SMTP/POP3 server to accept mails sent from your Rails application when it's running in development. The messages can be retrieved using a standard POP3 client, such as mail.app. Just connect to localhost with any username and password.
|
12
5
|
|
13
6
|
Note: Received messages are **not** sent to their final recipient and will remain available until deleted or when the process is quit.
|
@@ -31,6 +24,13 @@ Usage
|
|
31
24
|
|
32
25
|
This starts the service and listens on the specified ports (or 25 for SMTP and 110 for POP3 by default). Configure your POP3 client with any username and password.
|
33
26
|
|
27
|
+
Config
|
28
|
+
------
|
29
|
+
|
30
|
+
Post Office will try to find a configuration file (post_office/config.json) in the user dir ($HOME), and then in /etc. It will load the first one it finds.
|
31
|
+
|
32
|
+
The arguments passed on the command line will always override the ones specified in the config file.
|
33
|
+
|
34
34
|
Daemon
|
35
35
|
------
|
36
36
|
|
@@ -72,8 +72,26 @@ The Startup Item is stored in */Library/StartupItems/PostOffice*
|
|
72
72
|
Planned features
|
73
73
|
----------------
|
74
74
|
|
75
|
-
* Ability to use custom ports for SMTP and POP
|
76
|
-
* Growl notifications
|
77
75
|
* Store mail in tempfiles instead of in-memory array
|
78
76
|
|
79
77
|
Contributions are welcome! Feel free to fork and send a pull request through Github.
|
78
|
+
|
79
|
+
## Changelog
|
80
|
+
|
81
|
+
### 1.0.0 (Aug 11, 2016)
|
82
|
+
|
83
|
+
* [(tijn)](https://github.com/tijn) [load a config file and move default options (to become more DRY)](https://github.com/bluerail/post_office/pull/5)
|
84
|
+
* [(gamecreature)](https://github.com/gamecreature) [NOOP smtp command support](https://github.com/bluerail/post_office/pull/4)
|
85
|
+
* [(martijn)](https://github.com/martijn) Shorten timestamp in logs
|
86
|
+
|
87
|
+
### 0.3.3 (Sep 13, 2011)
|
88
|
+
|
89
|
+
* [(sgeorgi)](https://github.com/sgeorgi) [Specifying SMTP and POP3 ports on the command line](https://github.com/bluerail/post_office/pull/2)
|
90
|
+
|
91
|
+
### 0.3.2 (Sep 13, 2011)
|
92
|
+
|
93
|
+
Broken build
|
94
|
+
|
95
|
+
### 0.3.1 (Aug 16, 2011)
|
96
|
+
|
97
|
+
* First 'official' release
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/bin/post_office
CHANGED
@@ -6,39 +6,41 @@ require 'logger'
|
|
6
6
|
require 'thread'
|
7
7
|
require 'smtp_server.rb'
|
8
8
|
require 'pop_server.rb'
|
9
|
+
require 'config_file.rb'
|
10
|
+
|
11
|
+
options = ConfigFile.detect.read
|
9
12
|
|
10
13
|
#
|
11
14
|
# Parse command line arguments
|
12
15
|
#
|
13
|
-
options = {}
|
14
|
-
|
15
16
|
optparse = OptionParser.new do |opts|
|
16
17
|
opts.banner = "Usage: #{__FILE__} [options]"
|
17
18
|
|
18
|
-
options[:verbose]
|
19
|
+
options[:verbose] ||= false
|
19
20
|
opts.on( '-v', '--verbose', 'Output more information' ) do
|
20
21
|
options[:verbose] = true
|
21
22
|
end
|
22
23
|
|
23
|
-
options[:logfile]
|
24
|
+
options[:logfile] ||= nil
|
24
25
|
opts.on( '-l', '--logfile FILE', 'Write log to FILE. Outputs to STDOUT (or /var/log/post_office.log when daemonized) by default.' ) do |file|
|
25
26
|
options[:logfile] = file
|
26
27
|
end
|
27
28
|
|
28
|
-
options[:smtp_port]
|
29
|
+
options[:smtp_port] ||= 25
|
29
30
|
opts.on( '-s', '--smtp PORT', 'Specify SMTP port to use' ) do |port|
|
30
31
|
options[:smtp_port] = port
|
31
32
|
end
|
32
33
|
|
33
|
-
options[:pop3_port]
|
34
|
+
options[:pop3_port] ||= 110
|
34
35
|
opts.on( '-p', '--pop3 PORT', 'Specify POP3 port to use' ) do |port|
|
35
36
|
options[:pop3_port] = port
|
36
37
|
end
|
37
|
-
|
38
|
+
|
38
39
|
options[:startup_item] = nil
|
39
40
|
opts.on('--install-osx-startup-item', 'Installs Post Office as OS X Startup Item') do
|
40
41
|
options[:startup_item] = :install
|
41
42
|
end
|
43
|
+
|
42
44
|
opts.on('--remove-osx-startup-item', 'Removes Post Office as OS X Startup Item') do
|
43
45
|
options[:startup_item] = :remove
|
44
46
|
end
|
@@ -68,16 +70,17 @@ end
|
|
68
70
|
#
|
69
71
|
$log = Logger.new(options[:logfile] || STDOUT)
|
70
72
|
$log.level = options[:verbose] ? Logger::DEBUG : Logger::INFO
|
73
|
+
$log.datetime_format = "%H:%M:%S"
|
71
74
|
|
72
75
|
begin
|
73
|
-
smtp_server = Thread.new{ SMTPServer.new(options[:smtp_port]
|
74
|
-
pop_server = Thread.new{ POPServer.new(options[:pop3_port]
|
76
|
+
smtp_server = Thread.new{ SMTPServer.new(options[:smtp_port]) }
|
77
|
+
pop_server = Thread.new{ POPServer.new(options[:pop3_port]) }
|
75
78
|
|
76
79
|
smtp_server.join
|
77
80
|
pop_server.join
|
78
81
|
rescue Interrupt
|
79
82
|
$log.info "Interrupt..."
|
80
83
|
rescue Errno::EACCES
|
81
|
-
$log.error "I need root access to open ports #{options[:smtp_port]
|
84
|
+
$log.error "I need root access to open ports #{options[:smtp_port]} and / or #{options[:pop3_port]}. Please sudo #{__FILE__}"
|
82
85
|
end
|
83
86
|
|
data/lib/config_file.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
class ConfigFile
|
4
|
+
USER_CONFIG_DIR = ENV.fetch('XDG_CONFIG_HOME', ENV['HOME'] + '/.config')
|
5
|
+
SYSTEM_CONFIG_DIR = '/etc'
|
6
|
+
CONFIG_DIRS = [USER_CONFIG_DIR, SYSTEM_CONFIG_DIR]
|
7
|
+
attr_reader :filename
|
8
|
+
|
9
|
+
def initialize(filename)
|
10
|
+
@filename = filename
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.detect
|
14
|
+
filename =
|
15
|
+
CONFIG_DIRS.map { |dir| "#{dir}/post_office/config.json" }
|
16
|
+
.detect { |file| File.exist? file }
|
17
|
+
new(filename)
|
18
|
+
end
|
19
|
+
|
20
|
+
def read
|
21
|
+
return {} if @filename.nil?
|
22
|
+
JSON.parse(File.read(@filename), symbolize_names: true)
|
23
|
+
end
|
24
|
+
end
|
data/lib/smtp_server.rb
CHANGED
@@ -22,6 +22,7 @@ class SMTPServer < GenericServer
|
|
22
22
|
case command
|
23
23
|
when 'DATA' then data(client)
|
24
24
|
when 'HELO', 'EHLO' then respond(client, 250)
|
25
|
+
when 'NOOP' then respond(client, 250)
|
25
26
|
when 'MAIL' then mail_from(client, full_data)
|
26
27
|
when 'QUIT' then quit(client)
|
27
28
|
when 'RCPT' then rcpt_to(client, full_data)
|
data/post_office.gemspec
CHANGED
@@ -4,51 +4,39 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
7
|
+
s.name = "post_office"
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rene van Lieshout"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2016-08-11"
|
13
|
+
s.description = "A mock SMTP/POP3 server to aid in the development of applications with mail functionality."
|
14
|
+
s.email = "rene@bluerail.nl"
|
15
15
|
s.executables = ["post_office", "post_officed"]
|
16
16
|
s.extra_rdoc_files = [
|
17
|
+
"LICENSE",
|
17
18
|
"README.md"
|
18
19
|
]
|
19
20
|
s.files = [
|
21
|
+
"LICENSE",
|
20
22
|
"README.md",
|
21
23
|
"Rakefile",
|
22
24
|
"VERSION",
|
23
25
|
"bin/post_office",
|
24
26
|
"bin/post_officed",
|
27
|
+
"lib/config_file.rb",
|
25
28
|
"lib/generic_server.rb",
|
26
29
|
"lib/pop_server.rb",
|
27
30
|
"lib/smtp_server.rb",
|
28
31
|
"lib/startup_item.rb",
|
29
32
|
"lib/store.rb",
|
30
|
-
"pkg/post_office-0.1.0.gem",
|
31
|
-
"pkg/post_office-0.2.0.gem",
|
32
|
-
"pkg/post_office-0.2.1.gem",
|
33
|
-
"pkg/post_office-0.3.0.gem",
|
34
|
-
"pkg/post_office-0.3.1.gem",
|
35
|
-
"pkg/post_office-0.3.2.gem",
|
36
33
|
"post_office.gemspec",
|
37
34
|
"startup_item/PostOffice/PostOffice",
|
38
35
|
"startup_item/PostOffice/StartupParameters.plist"
|
39
36
|
]
|
40
|
-
s.homepage =
|
37
|
+
s.homepage = "http://github.com/bluerail/post_office"
|
41
38
|
s.require_paths = ["lib"]
|
42
|
-
s.rubygems_version =
|
43
|
-
s.summary =
|
44
|
-
|
45
|
-
if s.respond_to? :specification_version then
|
46
|
-
s.specification_version = 3
|
47
|
-
|
48
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
-
else
|
50
|
-
end
|
51
|
-
else
|
52
|
-
end
|
39
|
+
s.rubygems_version = "2.0.14.1"
|
40
|
+
s.summary = "PostOffice mock SMTP/POP3 server"
|
53
41
|
end
|
54
42
|
|
metadata
CHANGED
@@ -1,86 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: post_office
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 3
|
10
|
-
version: 0.3.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Rene van Lieshout
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-09-13 00:00:00 +02:00
|
19
|
-
default_executable:
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
20
12
|
dependencies: []
|
21
|
-
|
22
|
-
|
13
|
+
description: A mock SMTP/POP3 server to aid in the development of applications with
|
14
|
+
mail functionality.
|
23
15
|
email: rene@bluerail.nl
|
24
|
-
executables:
|
16
|
+
executables:
|
25
17
|
- post_office
|
26
18
|
- post_officed
|
27
19
|
extensions: []
|
28
|
-
|
29
|
-
|
20
|
+
extra_rdoc_files:
|
21
|
+
- LICENSE
|
30
22
|
- README.md
|
31
|
-
files:
|
23
|
+
files:
|
24
|
+
- LICENSE
|
32
25
|
- README.md
|
33
26
|
- Rakefile
|
34
27
|
- VERSION
|
35
28
|
- bin/post_office
|
36
29
|
- bin/post_officed
|
30
|
+
- lib/config_file.rb
|
37
31
|
- lib/generic_server.rb
|
38
32
|
- lib/pop_server.rb
|
39
33
|
- lib/smtp_server.rb
|
40
34
|
- lib/startup_item.rb
|
41
35
|
- lib/store.rb
|
42
|
-
- pkg/post_office-0.1.0.gem
|
43
|
-
- pkg/post_office-0.2.0.gem
|
44
|
-
- pkg/post_office-0.2.1.gem
|
45
|
-
- pkg/post_office-0.3.0.gem
|
46
|
-
- pkg/post_office-0.3.1.gem
|
47
|
-
- pkg/post_office-0.3.2.gem
|
48
36
|
- post_office.gemspec
|
49
37
|
- startup_item/PostOffice/PostOffice
|
50
38
|
- startup_item/PostOffice/StartupParameters.plist
|
51
|
-
has_rdoc: true
|
52
39
|
homepage: http://github.com/bluerail/post_office
|
53
40
|
licenses: []
|
54
|
-
|
41
|
+
metadata: {}
|
55
42
|
post_install_message:
|
56
43
|
rdoc_options: []
|
57
|
-
|
58
|
-
require_paths:
|
44
|
+
require_paths:
|
59
45
|
- lib
|
60
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
none: false
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 3
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
version: "0"
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
78
56
|
requirements: []
|
79
|
-
|
80
57
|
rubyforge_project:
|
81
|
-
rubygems_version:
|
58
|
+
rubygems_version: 2.0.14.1
|
82
59
|
signing_key:
|
83
|
-
specification_version:
|
60
|
+
specification_version: 4
|
84
61
|
summary: PostOffice mock SMTP/POP3 server
|
85
62
|
test_files: []
|
86
|
-
|
data/pkg/post_office-0.1.0.gem
DELETED
Binary file
|
data/pkg/post_office-0.2.0.gem
DELETED
Binary file
|
data/pkg/post_office-0.2.1.gem
DELETED
Binary file
|
data/pkg/post_office-0.3.0.gem
DELETED
Binary file
|
data/pkg/post_office-0.3.1.gem
DELETED
Binary file
|
data/pkg/post_office-0.3.2.gem
DELETED
Binary file
|