mailcatcher 0.1.6 → 0.2.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.
- data/.gitignore +1 -0
- data/LICENSE +17 -16
- data/README.md +6 -2
- data/Rakefile +43 -0
- data/VERSION +1 -0
- data/lib/mail_catcher.rb +7 -210
- data/lib/mail_catcher/events.rb +7 -0
- data/lib/mail_catcher/mail.rb +119 -0
- data/lib/mail_catcher/smtp.rb +48 -0
- data/lib/mail_catcher/web.rb +98 -0
- data/public/javascripts/application.js +94 -0
- data/public/javascripts/jquery.js +6883 -0
- data/public/stylesheets/application.css +23 -0
- data/views/index.haml +6 -104
- metadata +29 -31
@@ -0,0 +1,23 @@
|
|
1
|
+
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin:0px; padding:0px; border:0px; outline:0px; font-weight:inherit; font-style:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; }
|
2
|
+
body { line-height: 1; color: black; background: Window; color: WindowText; font-size: 12px; font-family: Helvetica, Arial, sans-serif; }
|
3
|
+
ol, ul { list-style: none; }
|
4
|
+
table { border-collapse: separate; border-spacing: 0px; }
|
5
|
+
caption, th, td { text-align: left; font-weight: normal; }
|
6
|
+
|
7
|
+
#mail { height: 10em; overflow: auto; background: ThreeDHighlight; border-bottom: 1px solid ButtonFace; }
|
8
|
+
#mail table { width: 100%; }
|
9
|
+
#mail table thead tr { background: ButtonHighlight; color: ButtonText; }
|
10
|
+
#mail table thead tr th { padding: .25em; font-weight: bold; }
|
11
|
+
#mail table tbody tr:nth-child(even) { background: ButtonHighlight; color: ButtonText; }
|
12
|
+
#mail table tbody tr.selected { background: Highlight; color: HighlightText; }
|
13
|
+
#mail table tbody tr td { padding: .25em; }
|
14
|
+
#message .metadata { padding: 1em; }
|
15
|
+
#message .metadata div { padding: .25em;; }
|
16
|
+
#message .metadata div label { display: inline-block; width: 8em; text-align: right; font-weight: bold; }
|
17
|
+
#message .metadata .attachments { display: none; }
|
18
|
+
#message .metadata .attachments ul { display: inline; }
|
19
|
+
#message .metadata .attachments ul li { display: inline-block; margin-right: .5em; }
|
20
|
+
#message .formats ul { border-bottom: 1px solid WindowFrame; padding: 0 .5em; }
|
21
|
+
#message .formats ul li { display: inline-block; padding: .5em; border: solid WindowFrame; background: ButtonFace; color: ButtonText; border-width: 1px 1px 0 1px; }
|
22
|
+
#message .formats ul li.selected { background: ThreeDHighlight; color: WindowText; height: 13px; margin-bottom: -1px; }
|
23
|
+
#message iframe { width: 100%; height: 42em; background: ThreeDHighlight; }
|
data/views/index.haml
CHANGED
@@ -2,109 +2,11 @@
|
|
2
2
|
%html
|
3
3
|
%head
|
4
4
|
%title MailCatcher
|
5
|
-
%
|
5
|
+
%link{:rel => "stylesheet", :href => "/stylesheets/application.css"}
|
6
|
+
%script{:src => "/javascripts/jquery.js"}
|
7
|
+
%script{:src => "/javascripts/application.js"}
|
6
8
|
:javascript
|
7
|
-
|
8
|
-
refresh: function() {
|
9
|
-
console.log('Refreshing mail');
|
10
|
-
$.getJSON('/mail', function(mail) {
|
11
|
-
$.each(mail, function(i, message) {
|
12
|
-
var row = $('<tr />').attr('data-message-id', message.id.toString());
|
13
|
-
$.each(['sender', 'recipients', 'subject', 'created_at'], function (i, property) {
|
14
|
-
row.append($('<td />').text(message[property]));
|
15
|
-
});
|
16
|
-
$('#mail tbody').append(row);
|
17
|
-
});
|
18
|
-
});
|
19
|
-
},
|
20
|
-
load: function(id) {
|
21
|
-
var id = id || $('#mail tr.selected').attr('data-message-id');
|
22
|
-
|
23
|
-
if (id !== null) {
|
24
|
-
console.log('Loading message', id);
|
25
|
-
|
26
|
-
$('#mail tbody tr:not([data-message-id="'+id+'"])').removeClass('selected');
|
27
|
-
$('#mail tbody tr[data-message-id="'+id+'"]').addClass('selected');
|
28
|
-
$.getJSON('/mail/' + id + '.json', function(message) {
|
29
|
-
$('#message .received span').text(message.created_at);
|
30
|
-
$('#message .from span').text(message.sender);
|
31
|
-
$('#message .to span').text(message.recipients);
|
32
|
-
$('#message .subject span').text(message.subject);
|
33
|
-
$('#message .formats ul li').each(function(i, el) {
|
34
|
-
var $el = $(el),
|
35
|
-
format = $el.attr('data-message-format');
|
36
|
-
if ($.inArray(format, message.formats) >= 0) {
|
37
|
-
$el.show();
|
38
|
-
} else {
|
39
|
-
$el.hide();
|
40
|
-
}
|
41
|
-
})
|
42
|
-
if ($("#message .formats ul li.selected:not(:visible)")) {
|
43
|
-
$("#message .formats ul li.selected").removeClass("selected");
|
44
|
-
$("#message .formats ul li:visible:first").addClass("selected");
|
45
|
-
}
|
46
|
-
if (message.attachments.length > 0) {
|
47
|
-
console.log(message.attachments);
|
48
|
-
$('#message .attachments ul').empty();
|
49
|
-
$.each(message.attachments, function (i, attachment) {
|
50
|
-
$('#message .attachments ul').append($('<li>').append($('<a>').attr('href', attachment['href']).addClass(attachment['type'].split('/', 1)[0]).addClass(attachment['type'].replace('/', '-')).text(attachment['filename'])));
|
51
|
-
});
|
52
|
-
$('#message .attachments').show();
|
53
|
-
} else {
|
54
|
-
$('#message .attachments').hide();
|
55
|
-
}
|
56
|
-
MailCatcher.loadBody();
|
57
|
-
});
|
58
|
-
}
|
59
|
-
},
|
60
|
-
loadBody: function(id, format) {
|
61
|
-
var id = id || $('#mail tr.selected').attr('data-message-id');
|
62
|
-
var format = format || $('#message .formats ul li.selected').first().attr('data-message-format') || 'html';
|
63
|
-
|
64
|
-
$('#message .formats ul li[data-message-format="'+format+'"]').addClass('selected');
|
65
|
-
$('#message .formats ul li:not([data-message-format="'+format+'"])').removeClass('selected');
|
66
|
-
|
67
|
-
if (id != undefined && id !== null) {
|
68
|
-
console.log('Loading message', id, 'in format', format);
|
69
|
-
|
70
|
-
$('#message iframe').attr('src', '/mail/' + id + '.' + format);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
};
|
74
|
-
|
75
|
-
$('#mail tr').live('click', function() {
|
76
|
-
MailCatcher.load($(this).attr('data-message-id'));
|
77
|
-
});
|
78
|
-
|
79
|
-
$('#message .formats ul li').live('click', function() {
|
80
|
-
MailCatcher.loadBody($('#mail tr.selected').attr('data-message-id'), $(this).attr('data-message-format'));
|
81
|
-
});
|
82
|
-
|
83
|
-
$(MailCatcher.refresh);
|
84
|
-
:css
|
85
|
-
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin:0px; padding:0px; border:0px; outline:0px; font-weight:inherit; font-style:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; }
|
86
|
-
body { line-height:1; color:black; background:white; font-size:12px; font-family:Helvetica, Arial, sans-serif; }
|
87
|
-
ol, ul { list-style:none; }
|
88
|
-
table { border-collapse:separate; border-spacing:0px; }
|
89
|
-
caption, th, td { text-align:left; font-weight:normal; }
|
90
|
-
|
91
|
-
#mail { height: 10em; overflow: scroll; }
|
92
|
-
#mail table { width: 100%; }
|
93
|
-
#mail table thead tr { background: #ccc; }
|
94
|
-
#mail table thead tr th { padding: .25em; font-weight: bold; }
|
95
|
-
#mail table tbody tr:nth-child(even) { background: #eee; }
|
96
|
-
#mail table tbody tr.selected { background: Highlight; color: HighlightText; }
|
97
|
-
#mail table tbody tr td { padding: .25em; }
|
98
|
-
#message .metadata { padding: 1em; background: #ccc; }
|
99
|
-
#message .metadata div { padding: .25em;; }
|
100
|
-
#message .metadata div label { display: inline-block; width: 8em; text-align: right; font-weight: bold; }
|
101
|
-
#message .metadata .attachments { display: none; }
|
102
|
-
#message .metadata .attachments ul { display: inline; }
|
103
|
-
#message .metadata .attachments ul li { display: inline-block; }
|
104
|
-
#message .formats ul { background: #ccc; border-bottom: 1px solid #666; padding: 0 .5em; }
|
105
|
-
#message .formats ul li { display: inline-block; padding: .5em; border: solid #666; border-width: 1px 1px 0 1px; }
|
106
|
-
#message .formats ul li.selected { background: white; height: 13px; margin-bottom: -1px; }
|
107
|
-
#message iframe { width: 100%; height: 42em; }
|
9
|
+
$(MailCatcher.init);
|
108
10
|
%body
|
109
11
|
#mail
|
110
12
|
%table
|
@@ -134,6 +36,6 @@
|
|
134
36
|
.formats
|
135
37
|
%ul
|
136
38
|
%li.selected{'data-message-format' => 'html'} HTML
|
137
|
-
%li{'data-message-format' => '
|
138
|
-
%li{'data-message-format' => '
|
39
|
+
%li{'data-message-format' => 'plain'} Plain Text
|
40
|
+
%li{'data-message-format' => 'source'} Source
|
139
41
|
%iframe
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Samuel Cochran
|
@@ -14,8 +14,8 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
18
|
-
default_executable:
|
17
|
+
date: 2010-10-28 00:00:00 +08:00
|
18
|
+
default_executable: mailcatcher
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: eventmachine
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
type: :runtime
|
32
32
|
version_requirements: *id001
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: mail
|
35
35
|
prerelease: false
|
36
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
37
|
none: false
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
type: :runtime
|
45
45
|
version_requirements: *id002
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: i18n
|
48
48
|
prerelease: false
|
49
49
|
requirement: &id003 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
type: :runtime
|
58
58
|
version_requirements: *id003
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
60
|
+
name: sqlite3-ruby
|
61
61
|
prerelease: false
|
62
62
|
requirement: &id004 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
@@ -83,7 +83,7 @@ dependencies:
|
|
83
83
|
type: :runtime
|
84
84
|
version_requirements: *id005
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
86
|
+
name: skinny
|
87
87
|
prerelease: false
|
88
88
|
requirement: &id006 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
type: :runtime
|
97
97
|
version_requirements: *id006
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
99
|
+
name: haml
|
100
100
|
prerelease: false
|
101
101
|
requirement: &id007 !ruby/object:Gem::Requirement
|
102
102
|
none: false
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
type: :runtime
|
110
110
|
version_requirements: *id007
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: json
|
113
113
|
prerelease: false
|
114
114
|
requirement: &id008 !ruby/object:Gem::Requirement
|
115
115
|
none: false
|
@@ -121,40 +121,38 @@ dependencies:
|
|
121
121
|
version: "0"
|
122
122
|
type: :runtime
|
123
123
|
version_requirements: *id008
|
124
|
-
|
125
|
-
name: i18n
|
126
|
-
prerelease: false
|
127
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
|
-
requirements:
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
segments:
|
133
|
-
- 0
|
134
|
-
version: "0"
|
135
|
-
type: :runtime
|
136
|
-
version_requirements: *id009
|
137
|
-
description: " MailCatcher runs a super simple SMTP server which catches any\n message sent to it to display in a web interface. Run\n mailcatcher, set your favourite app to deliver to\n smtp://127.0.0.1:1025 instead of your default SMTP server,\n then check out http://127.0.0.1:1080 to see the mail.\n"
|
124
|
+
description: " MailCatcher runs a super simple SMTP server which catches any\n message sent to it to display in a web interface. Run\n mailcatcher, set your favourite app to deliver to\n smtp://127.0.0.1:1025 instead of your default SMTP server,\n then check out http://127.0.0.1:1080 to see the mail.\n"
|
138
125
|
email: sj26@sj26.com
|
139
126
|
executables:
|
140
127
|
- mailcatcher
|
141
128
|
extensions: []
|
142
129
|
|
143
|
-
extra_rdoc_files:
|
144
|
-
|
130
|
+
extra_rdoc_files:
|
131
|
+
- LICENSE
|
132
|
+
- README.md
|
145
133
|
files:
|
134
|
+
- .gitignore
|
135
|
+
- LICENSE
|
136
|
+
- README.md
|
137
|
+
- Rakefile
|
138
|
+
- VERSION
|
146
139
|
- bin/mailcatcher
|
147
140
|
- lib/mail_catcher.rb
|
141
|
+
- lib/mail_catcher/events.rb
|
142
|
+
- lib/mail_catcher/mail.rb
|
143
|
+
- lib/mail_catcher/smtp.rb
|
144
|
+
- lib/mail_catcher/web.rb
|
145
|
+
- public/javascripts/application.js
|
146
|
+
- public/javascripts/jquery.js
|
147
|
+
- public/stylesheets/application.css
|
148
148
|
- views/index.haml
|
149
|
-
- README.md
|
150
|
-
- LICENSE
|
151
149
|
has_rdoc: true
|
152
150
|
homepage: http://github.com/sj26/mailcatcher
|
153
151
|
licenses: []
|
154
152
|
|
155
153
|
post_install_message:
|
156
|
-
rdoc_options:
|
157
|
-
|
154
|
+
rdoc_options:
|
155
|
+
- --charset=UTF-8
|
158
156
|
require_paths:
|
159
157
|
- lib
|
160
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|