sunabamail 0.1.0 → 0.1.2
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 +4 -4
- data/.github/workflows/main.yml +0 -1
- data/CHANGELOG.md +9 -0
- data/app/controllers/sunabamail/application_controller.rb +0 -2
- data/app/controllers/sunabamail/messages/application_controller.rb +1 -1
- data/app/controllers/sunabamail/messages/attachments_controller.rb +1 -1
- data/app/controllers/sunabamail/messages/htmls_controller.rb +1 -1
- data/app/controllers/sunabamail/messages/sources_controller.rb +3 -3
- data/app/controllers/sunabamail/messages/texts_controller.rb +3 -3
- data/app/controllers/sunabamail/messages_controller.rb +1 -1
- data/app/models/sunabamail/mail.rb +48 -0
- data/app/models/sunabamail/message.rb +1 -1
- data/app/views/sunabamail/messages/_message.html.erb +4 -7
- data/lib/sunabamail/version.rb +1 -1
- metadata +12 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c4339fd772c1bead6c12dbb69aa44c4271c1080a6bc15b8f0d6939609e052b2
|
|
4
|
+
data.tar.gz: 66ff4d243f7c392a25b8c11803d4133ef1ab2eaf2b3658df9165e5589a7c2790
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87f258c54ba3f6a7ca957b52abc8ba088454365518d8120858e373247787617c2900f387254377f829e4aad7e8622e087b39f12f04244d11b87ad873c73b3b45
|
|
7
|
+
data.tar.gz: f2cb19518101926daca43e79493dd0b560b98eddb40d7e8577ce4b8237d2ae5817975969bc4e30515466f9463d94f4454bc108b5fe506b90e33485718fc293db
|
data/.github/workflows/main.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.1.2] - 2026-05-08
|
|
4
|
+
|
|
5
|
+
- fix mailer view
|
|
6
|
+
|
|
7
|
+
## [0.1.1] - 2026-05-07
|
|
8
|
+
|
|
9
|
+
- fix Rails 7.x does't work.
|
|
10
|
+
- Changed the lower version to 7.1 due to several issues, including differences in the DB schema.
|
|
11
|
+
|
|
3
12
|
## [0.1.0] - 2026-05-06
|
|
4
13
|
|
|
5
14
|
- Initial release
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class Sunabamail::Messages::HtmlsController < Sunabamail::Messages::ApplicationController
|
|
2
2
|
def show
|
|
3
|
-
html = @message.mail.
|
|
3
|
+
html = @message.mail.html_body
|
|
4
4
|
doc = Nokogiri::HTML.fragment(html)
|
|
5
5
|
doc.css("a").each do |a|
|
|
6
6
|
a["target"] = "_blank"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
class Sunabamail::Messages::SourcesController < Sunabamail::Messages::ApplicationController
|
|
2
2
|
def show
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
html = @message.mail.html_body
|
|
4
|
+
|
|
5
|
+
send_data html, type: "text/plain", disposition: "inline"
|
|
6
6
|
end
|
|
7
7
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
class Sunabamail::Messages::TextsController < Sunabamail::Messages::ApplicationController
|
|
2
2
|
def show
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
text = @message.mail.text_body
|
|
4
|
+
|
|
5
|
+
send_data text, type: "text/plain", disposition: "inline"
|
|
6
6
|
end
|
|
7
7
|
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
class Sunabamail::Mail
|
|
2
|
+
def initialize(raw)
|
|
3
|
+
@mail_message = Mail::Message.new(raw.encoded)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def has_text?
|
|
7
|
+
return true if text_part.present?
|
|
8
|
+
|
|
9
|
+
"text/plain" == mime_type
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def has_html?
|
|
13
|
+
return true if html_part.present?
|
|
14
|
+
|
|
15
|
+
"text/html" == mime_type
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def text_body
|
|
19
|
+
if multipart?
|
|
20
|
+
decoded_body(text_part)
|
|
21
|
+
elsif "text/plain" == mime_type
|
|
22
|
+
decoded_body(mail_message)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def html_body
|
|
27
|
+
if multipart?
|
|
28
|
+
decoded_body(html_part)
|
|
29
|
+
elsif "text/html" == mime_type
|
|
30
|
+
decoded_body(mail_message)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def attachments = mail_message.attachments
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
attr_reader :mail_message
|
|
39
|
+
|
|
40
|
+
delegate :mime_type, :multipart?, :html_part, :text_part, to: :mail_message, private: true
|
|
41
|
+
|
|
42
|
+
def decoded_body(part)
|
|
43
|
+
return nil unless part
|
|
44
|
+
|
|
45
|
+
body = part.body.to_s.dup
|
|
46
|
+
part.charset ? body.force_encoding(part.charset) : body
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -48,23 +48,20 @@
|
|
|
48
48
|
</div>
|
|
49
49
|
<% end %>
|
|
50
50
|
|
|
51
|
-
<% has_html = mail.html_part.present? %>
|
|
52
|
-
<% has_text = mail.text_part.present? %>
|
|
53
|
-
|
|
54
51
|
<div class="message-views-tabs-container">
|
|
55
52
|
<div class="message-views-tabs">
|
|
56
|
-
<% if has_html %>
|
|
53
|
+
<% if mail.has_html? %>
|
|
57
54
|
<button class="message-view-tab" data-mail-view-handle data-mail-view-target="html">Html</button>
|
|
58
55
|
<button class="message-view-tab" data-mail-view-handle data-mail-view-target="source">Html Source</button>
|
|
59
56
|
<% end %>
|
|
60
|
-
<% if has_text %>
|
|
57
|
+
<% if mail.has_text? %>
|
|
61
58
|
<button class="message-view-tab" data-mail-view-handle data-mail-view-target="text">Text</button>
|
|
62
59
|
<% end %>
|
|
63
60
|
<button class="message-view-tab" data-mail-view-handle data-mail-view-target="raw">Raw</button>
|
|
64
61
|
</div>
|
|
65
62
|
</div>
|
|
66
63
|
|
|
67
|
-
<% if has_html %>
|
|
64
|
+
<% if mail.has_html? %>
|
|
68
65
|
<div class="message-view-item" data-mail-view="html">
|
|
69
66
|
<%= tag.iframe sealmess: "sealmess", data: { src: message_html_path(object) } %>
|
|
70
67
|
</div>
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
<%= tag.iframe sealmess: "sealmess", data: { src: message_source_path(object) } %>
|
|
73
70
|
</div>
|
|
74
71
|
<% end %>
|
|
75
|
-
<% if has_text %>
|
|
72
|
+
<% if mail.has_text? %>
|
|
76
73
|
<div class="message-view-item" data-mail-view="text">
|
|
77
74
|
<%= tag.iframe sealmess: "sealmess", data: { src: message_text_path(object) } %>
|
|
78
75
|
</div>
|
data/lib/sunabamail/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sunabamail
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- hamajyotan
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
@@ -15,42 +15,42 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '7.
|
|
18
|
+
version: '7.1'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '7.
|
|
25
|
+
version: '7.1'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: activerecord
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '7.
|
|
32
|
+
version: '7.1'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '7.
|
|
39
|
+
version: '7.1'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: railties
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '7.
|
|
46
|
+
version: '7.1'
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '7.
|
|
53
|
+
version: '7.1'
|
|
54
54
|
description: Provides a custom Action Mailer delivery method that stores outgoing
|
|
55
55
|
emails in the database instead of sending them. Stored emails can be viewed through
|
|
56
56
|
a dedicated interface, making it useful for development and staging environments.
|
|
@@ -75,6 +75,7 @@ files:
|
|
|
75
75
|
- app/controllers/sunabamail/messages/sources_controller.rb
|
|
76
76
|
- app/controllers/sunabamail/messages/texts_controller.rb
|
|
77
77
|
- app/controllers/sunabamail/messages_controller.rb
|
|
78
|
+
- app/models/sunabamail/mail.rb
|
|
78
79
|
- app/models/sunabamail/message.rb
|
|
79
80
|
- app/models/sunabamail/message_raw.rb
|
|
80
81
|
- app/models/sunabamail/record.rb
|
|
@@ -100,6 +101,8 @@ licenses:
|
|
|
100
101
|
metadata:
|
|
101
102
|
homepage_uri: https://github.com/hamajyotan/sunabamail
|
|
102
103
|
source_code_uri: https://github.com/hamajyotan/sunabamail
|
|
104
|
+
changelog_uri: https://github.com/hamajyotan/sunabamail/blob/main/CHANGELOG.md
|
|
105
|
+
rubygems_mfa_required: 'true'
|
|
103
106
|
rdoc_options: []
|
|
104
107
|
require_paths:
|
|
105
108
|
- lib
|
|
@@ -114,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
114
117
|
- !ruby/object:Gem::Version
|
|
115
118
|
version: '0'
|
|
116
119
|
requirements: []
|
|
117
|
-
rubygems_version:
|
|
120
|
+
rubygems_version: 3.6.7
|
|
118
121
|
specification_version: 4
|
|
119
122
|
summary: A drop-in Action Mailer delivery method that stores emails in the database
|
|
120
123
|
instead of sending them.
|