simpleMailer 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
data/lib/simpleMailer.rb CHANGED
@@ -15,7 +15,13 @@ class SimpleMailer
15
15
  @body=''
16
16
  @files=Array.new
17
17
  end
18
-
18
+
19
+ private
20
+ def cr_lf(string)
21
+ string.gsub('\r',"0x0D".hex.chr).gsub('\n',"0x0A".hex.chr)
22
+ end
23
+
24
+ public
19
25
  # Want an array
20
26
  def to(to)
21
27
  to.each do |ad|
@@ -37,7 +43,7 @@ class SimpleMailer
37
43
  end
38
44
 
39
45
  def message(message)
40
- @message=message
46
+ @message=cr_lf(message)
41
47
  self
42
48
  end
43
49
 
@@ -52,6 +58,10 @@ class SimpleMailer
52
58
  self
53
59
  end
54
60
 
61
+ def addr(field)
62
+ return field.gsub(/[^<]*<([^>]*)>/, '\1')
63
+ end
64
+
55
65
  def generate_file_part(file)
56
66
  b64file=String.new
57
67
  filename=File.basename(file)
@@ -96,7 +106,8 @@ EOF
96
106
  Net::SMTP.start(@host,@port) do |smtp|
97
107
  begin
98
108
  generate_body
99
- smtp.send_message(@body,@from,@to)
109
+ to = @to.map { |t| addr(t) }
110
+ smtp.send_message(@body,addr(@from),to)
100
111
  return true
101
112
  rescue => e
102
113
  e
data/simpleMailer.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simpleMailer}
8
- s.version = "0.1.8"
8
+ s.version = "0.1.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Yoann LE TOUCHE"]
12
- s.date = %q{2010-11-18}
12
+ s.date = %q{2012-06-06}
13
13
  s.description = %q{SimpleMailer is a simple wrapper for net::smtp that let you attach files}
14
14
  s.email = %q{kurotoshiro@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -29,15 +29,10 @@ Gem::Specification.new do |s|
29
29
  ]
30
30
  s.homepage = %q{http://github.com/Kurotoshiro/simpleMailer}
31
31
  s.require_paths = ["lib"]
32
- s.rubygems_version = %q{1.3.7}
32
+ s.rubygems_version = %q{1.6.2}
33
33
  s.summary = %q{A simple mailer gem}
34
- s.test_files = [
35
- "test/simpleMailer_test.rb",
36
- "test/test_helper.rb"
37
- ]
38
34
 
39
35
  if s.respond_to? :specification_version then
40
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
41
36
  s.specification_version = 3
42
37
 
43
38
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simpleMailer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
4
+ hash: 9
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 8
10
- version: 0.1.8
9
+ - 9
10
+ version: 0.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Yoann LE TOUCHE
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-18 00:00:00 +01:00
18
+ date: 2012-06-06 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -95,10 +95,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements: []
96
96
 
97
97
  rubyforge_project:
98
- rubygems_version: 1.3.7
98
+ rubygems_version: 1.6.2
99
99
  signing_key:
100
100
  specification_version: 3
101
101
  summary: A simple mailer gem
102
- test_files:
103
- - test/simpleMailer_test.rb
104
- - test/test_helper.rb
102
+ test_files: []
103
+