template_mailer 0.0.1 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83b2af7df86d4e00961e7e7863e1278b3d87cc17
4
- data.tar.gz: d330298ec3ace4d7975c389ddeb3855ace67b47e
3
+ metadata.gz: 29871198c723527ab70d04a0ea2c0fea60cc6cdf
4
+ data.tar.gz: 06909bc3174d1dd810a50d82c44d2680a222b7da
5
5
  SHA512:
6
- metadata.gz: 762b21bb217c393ac8bd12be866503b18d766c33aa2b7d7e8845a0626a900513305b2e7b16e7bc956467721cc3560bdc5366b859057ebbc758d973f542ff5c84
7
- data.tar.gz: ffd9d59f7f8b6e473eed31f686f43174c7d214df590274a438a195c25f3b861a8031d63b1f51e8e4696a23acd085215098576dd5ccabe78b097e77fa5bf55794
6
+ metadata.gz: 47dc7c98fc5b71d0455f98cfab084fb99bd63c49e13ace7ebbaf04bdf54e9b8797ba5146888797854904d37034ff954b96fda2ef84d1d629386f8a1f5c45adb2
7
+ data.tar.gz: 4a0e475c961b4b0acad21376bacb6019987a1c11677ba31548b11923628f9d1b4d8dc2cd33e826a922ce04f9153e1b37bacd848e28287d30e8592e161670ab81
data/README.md CHANGED
@@ -4,7 +4,7 @@ The Template Mailer library provides functionality to encapsulate the creation
4
4
  and dispatch of emails. The emails sent by the library are created from templates
5
5
  stored locally and allows for the creation of emails that are both HTML and/or
6
6
  textual based. The library makes use of the [Tilt](https://github.com/rtomayko/tilt)
7
- template library and the [Pony](https://github.com/benprew/pony libraries and
7
+ template library and the [Pony](https://github.com/benprew/pony) libraries and
8
8
  aspects of these interactions are exposed via configuration settings.
9
9
 
10
10
  ## Installation
@@ -52,7 +52,7 @@ module TemplateMailer
52
52
  # the complete settings together.
53
53
  def send_settings(settings)
54
54
  output = {to: settings[:recipients]}
55
- output[:subject] = settings[:subject]
55
+ output[:subject] = encode_subject(settings[:subject])
56
56
  output[:html_body] = @html if (@html || "") != ""
57
57
  output[:body] = @text if (@text || "") != ""
58
58
  output[:from] = settings[:from] if settings.include?(:from)
@@ -66,5 +66,14 @@ module TemplateMailer
66
66
  output[:via_options] = @server if @via == :smtp
67
67
  output
68
68
  end
69
+
70
+ # This method encodes the email subject line to get around issues with
71
+ # non-ASCII characters appearing in subject lines.
72
+ #
73
+ # ==== Parameters
74
+ # text:: A String containing the raw subject line text.
75
+ def encode_subject(text)
76
+ "=?utf-8?B?#{Base64.encode64(text)}?="
77
+ end
69
78
  end
70
- end
79
+ end
@@ -1,3 +1,3 @@
1
1
  module TemplateMailer
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -8,6 +8,9 @@ describe TemplateMailer::MailMessage do
8
8
  let(:title) {
9
9
  "Test Email"
10
10
  }
11
+ let(:encoded_title) {
12
+ "=?utf-8?B?#{Base64.encode64(title)}?="
13
+ }
11
14
  let(:html_body) {
12
15
  "<h1>HTML message.</h1>"
13
16
  }
@@ -34,7 +37,7 @@ describe TemplateMailer::MailMessage do
34
37
  {body: text_body,
35
38
  from: from,
36
39
  html_body: html_body,
37
- subject: title,
40
+ subject: encoded_title,
38
41
  to: recipients,
39
42
  via: :smtp,
40
43
  via_options: server}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: template_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Wood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-30 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.4.6
139
+ rubygems_version: 2.4.8
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: A simple library that uses the Tilt and Pony libraries to generate and dispatch