system_mail 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9654358979ce8c1dfa4d2df658edf452b13222f5
4
+ data.tar.gz: 1ee144255c8d17206e08640e0ab9f08740816d94
5
+ SHA512:
6
+ metadata.gz: e24d31c9683fc08e92a96d40e34ead42a7c9496fc5612dfb3180e4aab9025c513ae396d155bc1946719cf0cb5001a5e9f95b83ed8de3258913716205bf37c5c2
7
+ data.tar.gz: 47f08dedfa0edebacbf38b8d604389f4c45e119ae826e8cdc8375f4fc5c3886fe4f756b47a153f0b619164c9d4bd7060356c7fdacc9f005e219c858c42282658
data/CHANGES.md ADDED
@@ -0,0 +1,3 @@
1
+ #### 0.0.4
2
+
3
+ - Allow UTF-8 characters in From: and To: fields
@@ -169,8 +169,8 @@ module SystemMail
169
169
  end
170
170
 
171
171
  def write_headers
172
- @storage.puts "From: #{@from}" if @from
173
- @storage.puts "To: #{@to.join(', ')}"
172
+ @storage.puts "From: #{encode_from}" if @from
173
+ @storage.puts "To: #{encode_to}"
174
174
  @storage.puts "Subject: #{encode_subject}"
175
175
  end
176
176
 
@@ -245,7 +245,33 @@ module SystemMail
245
245
  end
246
246
 
247
247
  def encode_subject
248
- @subject.ascii_only? ? @subject : "=?UTF-8?B?#{Base64.strict_encode64 @subject}?="
248
+ @subject.ascii_only? ? @subject : encode_utf8(@subject)
249
+ end
250
+
251
+ def encode_from
252
+ encode_address(@from)
253
+ end
254
+
255
+ def encode_to
256
+ @to.map do |to|
257
+ encode_address(to)
258
+ end.join(', ')
259
+ end
260
+
261
+ def encode_address(address)
262
+ if address.ascii_only?
263
+ address
264
+ else
265
+ if matchdata = address.match(/(.+)\s\<(.+)\>/)
266
+ "#{encode_utf8 matchdata[1]} <#{matchdata[2]}>"
267
+ else
268
+ address
269
+ end
270
+ end
271
+ end
272
+
273
+ def encode_utf8(input)
274
+ "=?UTF-8?B?#{Base64.strict_encode64 input}?="
249
275
  end
250
276
  end
251
277
  end
@@ -1,3 +1,3 @@
1
1
  module SystemMail
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: system_mail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Igor Bochkariov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-27 00:00:00.000000000 Z
11
+ date: 2016-04-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: A Ruby library built to compose and deliver internet mail using operating
@@ -51,8 +46,9 @@ executables: []
51
46
  extensions: []
52
47
  extra_rdoc_files: []
53
48
  files:
54
- - .gitignore
55
- - .travis.yml
49
+ - ".gitignore"
50
+ - ".travis.yml"
51
+ - CHANGES.md
56
52
  - Gemfile
57
53
  - LICENSE.txt
58
54
  - README.md
@@ -69,27 +65,26 @@ files:
69
65
  homepage: https://github.com/ujifgc/system_mail
70
66
  licenses:
71
67
  - MIT
68
+ metadata: {}
72
69
  post_install_message:
73
70
  rdoc_options: []
74
71
  require_paths:
75
72
  - lib
76
73
  required_ruby_version: !ruby/object:Gem::Requirement
77
- none: false
78
74
  requirements:
79
- - - ! '>='
75
+ - - ">="
80
76
  - !ruby/object:Gem::Version
81
77
  version: '0'
82
78
  required_rubygems_version: !ruby/object:Gem::Requirement
83
- none: false
84
79
  requirements:
85
- - - ! '>='
80
+ - - ">="
86
81
  - !ruby/object:Gem::Version
87
82
  version: '0'
88
83
  requirements: []
89
84
  rubyforge_project:
90
- rubygems_version: 1.8.25
85
+ rubygems_version: 2.4.6
91
86
  signing_key:
92
- specification_version: 3
87
+ specification_version: 4
93
88
  summary: SystemMail is a blazing-fast Ruby Mail alternative with tiny memory footprint.
94
89
  test_files:
95
90
  - test/fixtures/test.html