letter_opener 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bfdc716edae6b329aa3dc67591aec9ea62e755e
4
- data.tar.gz: a8e46f86134d73fa0f49a56fbc9a86af5817da0e
3
+ metadata.gz: 6b1abff977a3febac5c5c93d7198750e409730c8
4
+ data.tar.gz: 40c22d29d8eeb33e7d7ac5149d64dba2665eae60
5
5
  SHA512:
6
- metadata.gz: eed6194ed2dddb66eb1d76574c32cfce8350242f4c6b034a15d0112e16294b93199697585c60c52682508b94c5d394a16734dbe2e913f08aae1c55f75277adcc
7
- data.tar.gz: 28316c457cdcd96ce3f4e343b2174b50ee1f3476b78785a179904f8275ff862db188b97a22d56eba09585f30f33d8b905708ea2a39c9136f0f68d640567512cf
6
+ metadata.gz: 00ac078e821bebeb9b4dd1b909db43a96bda5df54bcc11f635ae0478cd6278b29ee127d1c668c5f6421af8b17a34d2cad5a083bc9f18d8632b0b5c006e63e83b
7
+ data.tar.gz: 061baa01266531a9c4fde77c43d04c76619d8232837f06502d4ab06b4a97e0849f88068e51af313521540ea554041eb524a5f644622f5f536d041128ae936315
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.3.0 ##
2
+
3
+ * Fix message body encoding is observed correctly in QP CTE. (thanks [Mark Dodwell](https://github.com/mkdynamic))
4
+ * Remove fixed width on the mail content. (thanks [weexpectedTHIS](https://github.com/weexpectedTHIS))
5
+ * Render email content in the iframe. Fixes [#98](https://github.com/ryanb/letter_opener/issues/98). (thanks [Jacob Maine](https://github.com/mainej))
6
+
1
7
  ## 1.2.0 ##
2
8
 
3
9
  * Fix auto_link() which in some cases would return an empty <a> tag for plain text messages. (thanks [Kevin McPhillips](https://github.com/kmcphillips))
data/README.rdoc CHANGED
@@ -47,7 +47,7 @@ Alternatively, if you are using ActionMailer directly (without Rails) you will n
47
47
 
48
48
  Letter Opener uses {Launchy}[https://github.com/copiousfreetime/launchy] to open sent mail in the browser. This assumes the Ruby process is running on the local development machine. If you are using a separate staging server or VM this will not work. In that case consider using {Mailtrap}[http://mailtrap.io/] or {MailCatcher}[http://mailcatcher.me/].
49
49
 
50
- In order to keep this project simple, I don't have plans to turn it into a Rails engine with an interface for browsing the sent mail but there is a work in progress gem being developed at https://github.com/fgrehm/letter_opener_web
50
+ In order to keep this project simple, I don't have plans to turn it into a Rails engine with an interface for browsing the sent mail but there is a {gem you can use for that}[https://github.com/fgrehm/letter_opener_web].
51
51
 
52
52
 
53
53
  == Development & Feedback
@@ -8,7 +8,6 @@
8
8
  <style type="text/css">
9
9
  #container {
10
10
  margin: 10px auto;
11
- width: 800px;
12
11
  }
13
12
  #message_headers {
14
13
  background: #fff;
@@ -53,6 +52,12 @@
53
52
  border: 1px solid #eee;
54
53
  background-color: #fcfcfc;
55
54
  }
55
+
56
+ iframe {
57
+ border: 0;
58
+ width: 100%;
59
+ height: 100%;
60
+ }
56
61
  </style>
57
62
  </head>
58
63
  <body>
@@ -119,7 +124,7 @@
119
124
  <% if type == "plain" %>
120
125
  <pre id="message_body"><%= auto_link(h(body)) %></pre>
121
126
  <% else %>
122
- <%= body %>
127
+ <iframe seamless="seamless" srcdoc="<%= h(body) %>"></iframe>
123
128
  <% end %>
124
129
  </div>
125
130
  </body>
@@ -57,7 +57,7 @@ module LetterOpener
57
57
 
58
58
  def body
59
59
  @body ||= begin
60
- body = (@part && @part.body || @mail.body).to_s
60
+ body = (@part || @mail).decoded
61
61
 
62
62
  mail.attachments.each do |attachment|
63
63
  body.gsub!(attachment.url, "attachments/#{attachment.filename}")
@@ -1,7 +1,9 @@
1
1
  module LetterOpener
2
2
  class Railtie < Rails::Railtie
3
3
  initializer "letter_opener.add_delivery_method" do
4
- ActionMailer::Base.add_delivery_method :letter_opener, LetterOpener::DeliveryMethod, :location => Rails.root.join("tmp", "letter_opener")
4
+ ActiveSupport.on_load :action_mailer do
5
+ ActionMailer::Base.add_delivery_method :letter_opener, LetterOpener::DeliveryMethod, :location => Rails.root.join("tmp", "letter_opener")
6
+ end
5
7
  end
6
8
  end
7
9
  end
@@ -1,10 +1,11 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  describe LetterOpener::Message do
4
5
  let(:location) { File.expand_path('../../../tmp/letter_opener', __FILE__) }
5
6
 
6
- def mail(options={})
7
- Mail.new(options)
7
+ def mail(options={}, &blk)
8
+ Mail.new(options, &blk)
8
9
  end
9
10
 
10
11
  describe '#reply_to' do
@@ -164,4 +165,40 @@ describe LetterOpener::Message do
164
165
  expect(message.auto_link(raw)).to eq(linked)
165
166
  end
166
167
  end
168
+
169
+ describe '#body' do
170
+ it 'handles UTF-8 charset body correctly, with QP CTE, for a non-multipart message' do
171
+ mail = mail(:sender => 'sender@example.com') do
172
+ content_type "text/html; charset=UTF-8"
173
+ content_transfer_encoding 'quoted-printable'
174
+ body "☃"
175
+ end
176
+ message = described_class.new(location, mail)
177
+ expect(message.body.encoding.name).to eq('UTF-8')
178
+ end
179
+
180
+ it 'handles UTF-8 charset HTML part body correctly, with QP CTE, for a multipart message' do
181
+ mail = mail(:sender => 'sender@example.com') do
182
+ html_part do
183
+ content_type "text/html; charset=UTF-8"
184
+ content_transfer_encoding 'quoted-printable'
185
+ body "☃"
186
+ end
187
+ end
188
+ message = described_class.new(location, mail, mail.html_part)
189
+ expect(message.body.encoding.name).to eq('UTF-8')
190
+ end
191
+
192
+ it 'handles UTF-8 charset text part body correctly, with QP CTE, for a multipart message' do
193
+ mail = mail(:sender => 'sender@example.com') do
194
+ text_part do
195
+ content_type "text/plain; charset=UTF-8"
196
+ content_transfer_encoding 'quoted-printable'
197
+ body "☃"
198
+ end
199
+ end
200
+ message = described_class.new(location, mail, mail.text_part)
201
+ expect(message.body.encoding.name).to eq('UTF-8')
202
+ end
203
+ end
167
204
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letter_opener
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2014-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.14.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.14.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mail
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.5.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.5.0
55
55
  description: When mail is sent from your application, Letter Opener will open a preview
@@ -59,19 +59,19 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - CHANGELOG.md
63
+ - Gemfile
64
+ - LICENSE
65
+ - README.rdoc
66
+ - Rakefile
67
+ - lib/letter_opener.rb
62
68
  - lib/letter_opener/delivery_method.rb
63
69
  - lib/letter_opener/message.html.erb
64
70
  - lib/letter_opener/message.rb
65
71
  - lib/letter_opener/railtie.rb
66
- - lib/letter_opener.rb
67
72
  - spec/letter_opener/delivery_method_spec.rb
68
73
  - spec/letter_opener/message_spec.rb
69
74
  - spec/spec_helper.rb
70
- - CHANGELOG.md
71
- - Gemfile
72
- - LICENSE
73
- - Rakefile
74
- - README.rdoc
75
75
  homepage: http://github.com/ryanb/letter_opener
76
76
  licenses: []
77
77
  metadata: {}
@@ -81,17 +81,17 @@ require_paths:
81
81
  - lib
82
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - '>='
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: 1.3.4
92
92
  requirements: []
93
93
  rubyforge_project: letter_opener
94
- rubygems_version: 2.1.11
94
+ rubygems_version: 2.2.2
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Preview mail in browser instead of sending.