mailtrap 0.2.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- metadata +43 -98
- data/History.txt +0 -5
- data/Manifest.txt +0 -6
- data/README.txt +0 -75
- data/Rakefile +0 -20
- data/bin/mailtrap +0 -28
- data/lib/mailtrap.rb +0 -130
- data/test/test_mailtrap.rb +0 -0
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8f8ebec30c2db47c2767aa07c023862cd7db74170cc156003307c55530502a56
|
4
|
+
data.tar.gz: eb649353ced2c73f9ca0eb08311d4f6d1bea52f039b06eb71c3d7eae1aab20ce
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6f62f15dad68d35c03d6b40fdbee216cd3046f72f4035c617f77447a38f80417708cc617a7711f93c963d49ce3b058a6a97a532fc413b7944a4d5f53de454c66
|
7
|
+
data.tar.gz: 51ec61c78c6a61de109d28435dcc1b4ed229300e5c6100ab4961d79e18973c7877c479f38c4259f7a3483c2840f19b034c61344be98d187ad9ce1de795bae2bb
|
metadata
CHANGED
@@ -1,102 +1,47 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
1
|
+
--- !ruby/object:Gem::Specification
|
4
2
|
name: mailtrap
|
5
|
-
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-10-12 00:00:00 +01:00
|
8
|
-
summary: Mailtrap is a mock SMTP server for use in Rails development
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: self@mattmower.com
|
12
|
-
homepage: " by Matt Mower <self@mattmower.com>"
|
13
|
-
rubyforge_project: rubymatt
|
14
|
-
description: "Mailtrap is a mock SMTP server for use in Rails development. Mailtrap waits on your choosen port for a client to connect and talks _just enough_ SMTP protocol for ActionMailer to successfully deliver its message. Mailtrap makes *no* attempt to actually deliver messages and, instead, writes them into a file (hence the name \tMail_trap_). Handy tip: use tail -f to see emails being received. You can configure the hostname (default: localhost) and port (default: 2525) for the server and also where the messages get written (default: /var/tmp/mailtrap.log). == FEATURES/PROBLEMS:"
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
25
5
|
platform: ruby
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
pDsZVfsRcUZ0dWetp+ll7Lq/4HyecdNgRfmrQh6pmKwIUmh5cj91iBX3NEqx5TN6
|
38
|
-
AKkYIOBMuOnBMNrXvApH10ruvus1d/PiJIjAavvbgSih+vyB8NTXTF4kOhKXnF0w
|
39
|
-
Zx3CF5asJejopRGNUcY9Vmjr7WiRHhUnFjc8hs385MlQNKEdAirVwIIgWfkQwJO+
|
40
|
-
GQ0CAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFL99
|
41
|
-
Fuw4VZwExQog/QSr8zIFfj1WMA0GCSqGSIb3DQEBBQUAA4IBAQATHmiqgSFKeJQM
|
42
|
-
QZjefTiRH6q1TgnJEt0/ylb9gNUCBpIFC1QOtuf68NAt90n6q1CZ51W3EreOPmi2
|
43
|
-
k2UxzfnPH6av2HQxmC1Xwv+X/eKF65shy/D75XWeCKLwynlXbA0cSjkV8/jSDB9I
|
44
|
-
pPXX1PjTNmzS2oNGSBroG567Uod41eAjlFA2FQTSWu/lDaYvLBjupGzz59/lZfkl
|
45
|
-
oCvK+OORDtfJ/a8CdYuD7PltGIEGV9srqdsEsmcrXGHaZt+jGRLYi60h5ZEd7lOm
|
46
|
-
1WEvMXOXF3ofp87Yw1MSpG7yQyr0i5DW6VM3v6AP0ABxoM4p80JDHhwAmKWRWWQk
|
47
|
-
yMQ/kUco
|
48
|
-
-----END CERTIFICATE-----
|
49
|
-
|
50
|
-
post_install_message:
|
51
|
-
authors:
|
52
|
-
- Matt Mower
|
53
|
-
files:
|
54
|
-
- History.txt
|
55
|
-
- Manifest.txt
|
56
|
-
- README.txt
|
57
|
-
- Rakefile
|
58
|
-
- bin/mailtrap
|
59
|
-
- lib/mailtrap.rb
|
60
|
-
test_files:
|
61
|
-
- test/test_mailtrap.rb
|
62
|
-
rdoc_options:
|
63
|
-
- --main
|
64
|
-
- README.txt
|
65
|
-
extra_rdoc_files:
|
66
|
-
- History.txt
|
67
|
-
- Manifest.txt
|
68
|
-
- README.txt
|
69
|
-
executables:
|
70
|
-
- mailtrap
|
6
|
+
authors:
|
7
|
+
- Railsware Products Studio, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Official mailtrap.io API client
|
14
|
+
email:
|
15
|
+
- support@mailtrap.io
|
16
|
+
executables: []
|
71
17
|
extensions: []
|
72
|
-
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files: []
|
20
|
+
homepage: https://github.com/railsware/mailtrap-ruby
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata:
|
24
|
+
homepage_uri: https://github.com/railsware/mailtrap-ruby
|
25
|
+
source_code_uri: https://github.com/railsware/mailtrap-ruby
|
26
|
+
changelog_uri: https://github.com/railsware/mailtrap-ruby/blob/main/CHANGELOG.md
|
27
|
+
rubygems_mfa_required: 'true'
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.7.0
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
73
42
|
requirements: []
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: 1.0.8
|
84
|
-
version:
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: trollop
|
87
|
-
version_requirement:
|
88
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
89
|
-
requirements:
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: "1.7"
|
93
|
-
version:
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: hoe
|
96
|
-
version_requirement:
|
97
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
98
|
-
requirements:
|
99
|
-
- - ">="
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 1.3.0
|
102
|
-
version:
|
43
|
+
rubygems_version: 3.1.6
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: Official mailtrap.io API client
|
47
|
+
test_files: []
|
data/History.txt
DELETED
data/Manifest.txt
DELETED
data/README.txt
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
mailtrap
|
2
|
-
by Matt Mower <self@mattmower.com>
|
3
|
-
http://matt.blogs.it/
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
Mailtrap is a mock SMTP server for use in Rails development.
|
8
|
-
|
9
|
-
Mailtrap waits on your choosen port for a client to connect and talks _just enough_ SMTP protocol for ActionMailer to successfully deliver its message.
|
10
|
-
|
11
|
-
Mailtrap makes *no* attempt to actually deliver messages and, instead, writes them into a file (hence the name Mail_trap_). Handy tip: use tail -f to see emails being received.
|
12
|
-
|
13
|
-
You can configure the hostname (default: localhost) and port (default: 2525) for the server and also where the messages get written (default: /var/tmp/mailtrap.log).
|
14
|
-
|
15
|
-
== FEATURES/PROBLEMS:
|
16
|
-
|
17
|
-
* Lightweight, no setup
|
18
|
-
* Runs as a daemon with start, stop, etc..
|
19
|
-
* Tested with ActionMailer's SMTP delivery method
|
20
|
-
* Very, very, dumb ... might not work with an arbitrary SMTP client
|
21
|
-
|
22
|
-
== SYNOPSIS:
|
23
|
-
|
24
|
-
To use the defaults host:localhost, port:2525, file:/var/log/mailtrap.log
|
25
|
-
|
26
|
-
* mailtrap start
|
27
|
-
|
28
|
-
Customise startup:
|
29
|
-
|
30
|
-
* sudo mailtrap start --host my.host --port 25 --once --file=/var/log/messages.txt
|
31
|
-
|
32
|
-
(sudo because you want to use restricted port 25)
|
33
|
-
|
34
|
-
For more info:
|
35
|
-
|
36
|
-
* mailtrap --help (to see Daemonization options)
|
37
|
-
* mailtrap start --help (to see Mailtrap options)
|
38
|
-
|
39
|
-
== REQUIREMENTS:
|
40
|
-
|
41
|
-
* Hoe rubygem
|
42
|
-
* Rubygems rubygem
|
43
|
-
* Daemons rubygem
|
44
|
-
* Trollop rubygem
|
45
|
-
|
46
|
-
All these are automatically installed if you use gem install -y
|
47
|
-
|
48
|
-
== INSTALL:
|
49
|
-
|
50
|
-
* sudo gem install -y mailtrap
|
51
|
-
|
52
|
-
== LICENSE:
|
53
|
-
|
54
|
-
(The MIT License)
|
55
|
-
|
56
|
-
Copyright (c) 2007 Matt Mower, Software Heretics
|
57
|
-
|
58
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
59
|
-
a copy of this software and associated documentation files (the
|
60
|
-
'Software'), to deal in the Software without restriction, including
|
61
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
62
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
63
|
-
permit persons to whom the Software is furnished to do so, subject to
|
64
|
-
the following conditions:
|
65
|
-
|
66
|
-
The above copyright notice and this permission notice shall be
|
67
|
-
included in all copies or substantial portions of the Software.
|
68
|
-
|
69
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
70
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
71
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
72
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
73
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
74
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
75
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
|
-
require './lib/mailtrap.rb'
|
6
|
-
|
7
|
-
Hoe.new('mailtrap', Mailtrap::VERSION ) do |p|
|
8
|
-
p.rubyforge_name = 'rubymatt'
|
9
|
-
p.author = 'Matt Mower'
|
10
|
-
p.email = 'self@mattmower.com'
|
11
|
-
p.summary = 'Mailtrap is a mock SMTP server for use in Rails development'
|
12
|
-
p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
13
|
-
p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
|
14
|
-
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
15
|
-
p.remote_rdoc_dir = 'mailtrap'
|
16
|
-
p.extra_deps << ['daemons','>= 1.0.8']
|
17
|
-
p.extra_deps << ['trollop','>= 1.7']
|
18
|
-
end
|
19
|
-
|
20
|
-
# vim: syntax=Ruby
|
data/bin/mailtrap
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Run the mailtrap server
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
require 'daemons'
|
8
|
-
require 'mailtrap'
|
9
|
-
|
10
|
-
opts = Trollop::options do
|
11
|
-
opt :host, "The host SMTP clients will connect to", :default => 'localhost'
|
12
|
-
opt :port, "The port SMTP clients will connect to", :default => 2525
|
13
|
-
opt :once, "Whether to terminate after serving the first client", :default => false
|
14
|
-
opt :file, "File where messages get written", :default => "/var/tmp/mailtrap.log"
|
15
|
-
end
|
16
|
-
|
17
|
-
options = {
|
18
|
-
:dir_mode => :normal,
|
19
|
-
:dir => '/var/tmp',
|
20
|
-
:multiple => true,
|
21
|
-
:mode => :exec,
|
22
|
-
:backtrace => true,
|
23
|
-
:log_output => true
|
24
|
-
}
|
25
|
-
|
26
|
-
Daemons.run_proc( 'mailtrap', options ) do
|
27
|
-
Mailtrap.new( opts[:host], opts[:port], opts[:once], opts[:file] )
|
28
|
-
end
|
data/lib/mailtrap.rb
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'daemons'
|
4
|
-
require 'socket'
|
5
|
-
require 'trollop'
|
6
|
-
|
7
|
-
#
|
8
|
-
# Mailtrap creates a TCP server that listens on a specified port for SMTP
|
9
|
-
# clients. Accepts the connection and talks just enough of the SMTP protocol
|
10
|
-
# for them to deliver a message which it writes to disk.
|
11
|
-
#
|
12
|
-
class Mailtrap
|
13
|
-
VERSION = '0.2.1'
|
14
|
-
|
15
|
-
# Create a new Mailtrap on the specified host:port. If once it true it
|
16
|
-
# will listen for one message then exit. Specify the msgdir where messages
|
17
|
-
# are written.
|
18
|
-
def initialize( host, port, once, msgfile )
|
19
|
-
@host = host
|
20
|
-
@port = port
|
21
|
-
@once = once
|
22
|
-
@msgfile = msgfile
|
23
|
-
|
24
|
-
File.open( @msgfile, "a" ) do |file|
|
25
|
-
file.puts "\n* Mailtrap started at #{@host}:#{port}\n"
|
26
|
-
end
|
27
|
-
|
28
|
-
service = TCPServer.new( @host, @port )
|
29
|
-
accept( service )
|
30
|
-
end
|
31
|
-
|
32
|
-
# Service one or more SMTP client connections
|
33
|
-
def accept( service )
|
34
|
-
while session = service.accept
|
35
|
-
|
36
|
-
class << session
|
37
|
-
def get_line
|
38
|
-
line = gets
|
39
|
-
line.chomp! unless line.nil?
|
40
|
-
line
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
begin
|
45
|
-
serve( session )
|
46
|
-
rescue Exception => e
|
47
|
-
puts "Erk! #{e.message}"
|
48
|
-
end
|
49
|
-
|
50
|
-
break if @once
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Write a plain text dump of the incoming email to a text
|
55
|
-
# file. The file will be in the @msgdir folder and will
|
56
|
-
# be called smtp0001.msg, smtp0002.msg, and so on.
|
57
|
-
def write( from, to_list, message )
|
58
|
-
|
59
|
-
# Strip SMTP commands from To: and From:
|
60
|
-
from.gsub!( /MAIL FROM:\s*/, "" )
|
61
|
-
to_list = to_list.map { |to| to.gsub( /RCPT TO:\s*/, "" ) }
|
62
|
-
|
63
|
-
# Append to the end of the messages file
|
64
|
-
File.open( @msgfile, "a" ) do |file|
|
65
|
-
file.puts "* Message begins"
|
66
|
-
file.puts "From: #{from}"
|
67
|
-
file.puts "To: #{to_list.join(", ")}"
|
68
|
-
file.puts "Body:"
|
69
|
-
file.puts message
|
70
|
-
file.puts "\n* Message ends"
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
# Talk pidgeon-SMTP to the client to get them to hand over the message
|
76
|
-
# and go away.
|
77
|
-
def serve( connection )
|
78
|
-
connection.puts( "220 #{@host} MailTrap ready ESTMP" )
|
79
|
-
helo = connection.get_line # whoever they are
|
80
|
-
puts "Helo: #{helo}"
|
81
|
-
|
82
|
-
if helo =~ /^EHLO\s+/
|
83
|
-
puts "Seen an EHLO"
|
84
|
-
connection.puts "250-#{@host} offers just ONE extension my pretty"
|
85
|
-
connection.puts "250 HELP"
|
86
|
-
end
|
87
|
-
|
88
|
-
# Accept MAIL FROM:
|
89
|
-
from = connection.get_line
|
90
|
-
connection.puts( "250 OK" )
|
91
|
-
puts "From: #{from}"
|
92
|
-
|
93
|
-
to_list = []
|
94
|
-
|
95
|
-
# Accept RCPT TO: until we see DATA
|
96
|
-
loop do
|
97
|
-
to = connection.get_line
|
98
|
-
break if to.nil?
|
99
|
-
|
100
|
-
if to =~ /^DATA/
|
101
|
-
connection.puts( "354 Start your message" )
|
102
|
-
break
|
103
|
-
else
|
104
|
-
puts "To: #{to}"
|
105
|
-
to_list << to
|
106
|
-
connection.puts( "250 OK" )
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
# Capture the message body terminated by <CR>.<CR>
|
111
|
-
lines = []
|
112
|
-
loop do
|
113
|
-
line = connection.get_line
|
114
|
-
break if line.nil? || line == "."
|
115
|
-
lines << line
|
116
|
-
puts "+ #{line}"
|
117
|
-
end
|
118
|
-
|
119
|
-
# We expect the client will go away now
|
120
|
-
connection.puts( "250 OK" )
|
121
|
-
connection.gets # Quit
|
122
|
-
connection.puts "221 Seeya"
|
123
|
-
connection.close
|
124
|
-
puts "And we're done with that bozo!"
|
125
|
-
|
126
|
-
write( from, to_list, lines.join( "\n" ) )
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
data/test/test_mailtrap.rb
DELETED
File without changes
|
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
Binary file
|