kurotoshiro-simpleMailer 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/simpleMailer.rb +13 -16
- data/simpleMailer.gemspec +7 -6
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/lib/simpleMailer.rb
CHANGED
@@ -3,26 +3,24 @@ class SimpleMailer
|
|
3
3
|
require 'net/smtp'
|
4
4
|
require 'shared-mime-info'
|
5
5
|
|
6
|
-
attr_accessor :host, :port
|
7
|
-
attr_accessor :from, :to
|
8
|
-
attr_accessor :title, :message
|
9
|
-
attr_accessor :files
|
10
|
-
|
11
6
|
MARKER="THATSMAMARKER"
|
12
7
|
|
13
8
|
def initialize(host="",port=25)
|
14
9
|
@host=host
|
15
10
|
@port=port
|
16
|
-
@from=
|
17
|
-
@to=
|
18
|
-
@title=
|
19
|
-
@message=
|
11
|
+
@from=''
|
12
|
+
@to=''
|
13
|
+
@title=''
|
14
|
+
@message=''
|
15
|
+
@body=''
|
20
16
|
@files=Array.new
|
21
|
-
@body=""
|
22
17
|
end
|
23
|
-
|
18
|
+
|
19
|
+
# Want an array
|
24
20
|
def to(to)
|
25
|
-
|
21
|
+
to.each do |ad|
|
22
|
+
raise "Not a proper email address" unless ad.match(/.+@.+\..+/)
|
23
|
+
end
|
26
24
|
@to=to
|
27
25
|
self
|
28
26
|
end
|
@@ -33,7 +31,7 @@ class SimpleMailer
|
|
33
31
|
self
|
34
32
|
end
|
35
33
|
|
36
|
-
def
|
34
|
+
def title(title)
|
37
35
|
@title=title
|
38
36
|
self
|
39
37
|
end
|
@@ -44,7 +42,7 @@ class SimpleMailer
|
|
44
42
|
end
|
45
43
|
|
46
44
|
# WARNING : with_files clear @files before adding new ones
|
47
|
-
def
|
45
|
+
def attach_files(files)
|
48
46
|
@files=Array.new
|
49
47
|
files.each do |file|
|
50
48
|
raise "File #{file} doesn't exist" unless File.exists?(file)
|
@@ -69,7 +67,6 @@ Content-Transfer-Encoding: base64
|
|
69
67
|
|
70
68
|
#{b64file}
|
71
69
|
|
72
|
-
|
73
70
|
EOF
|
74
71
|
end
|
75
72
|
|
@@ -77,7 +74,7 @@ EOF
|
|
77
74
|
def generate_body
|
78
75
|
@body =<<EOF
|
79
76
|
From: #{@from}
|
80
|
-
To: #{@to}
|
77
|
+
To: #{@to.join(",")}
|
81
78
|
Subject: #{@title}
|
82
79
|
MIME-Version: 1.0
|
83
80
|
Content-Type: multipart/mixed; boundary=#{MARKER}
|
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
|
+
s.version = "0.1.6"
|
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{2009-08-
|
12
|
+
s.date = %q{2009-08-31}
|
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 = [
|
@@ -28,19 +28,20 @@ Gem::Specification.new do |s|
|
|
28
28
|
"test/simpleMailer_test.rb",
|
29
29
|
"test/test_helper.rb"
|
30
30
|
]
|
31
|
+
s.has_rdoc = true
|
31
32
|
s.homepage = %q{http://github.com/Kurotoshiro/simpleMailer}
|
32
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
33
34
|
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.
|
35
|
+
s.rubygems_version = %q{1.3.1}
|
35
36
|
s.summary = %q{A simple mailer gem}
|
36
37
|
s.test_files = [
|
37
|
-
"test/
|
38
|
-
"test/
|
38
|
+
"test/test_helper.rb",
|
39
|
+
"test/simpleMailer_test.rb"
|
39
40
|
]
|
40
41
|
|
41
42
|
if s.respond_to? :specification_version then
|
42
43
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
-
s.specification_version =
|
44
|
+
s.specification_version = 2
|
44
45
|
|
45
46
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
46
47
|
s.add_runtime_dependency(%q<shared-mime-info>, [">= 0"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kurotoshiro-simpleMailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoann LE TOUCHE
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-31 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -52,7 +52,7 @@ files:
|
|
52
52
|
- simpleMailer.gemspec
|
53
53
|
- test/simpleMailer_test.rb
|
54
54
|
- test/test_helper.rb
|
55
|
-
has_rdoc:
|
55
|
+
has_rdoc: true
|
56
56
|
homepage: http://github.com/Kurotoshiro/simpleMailer
|
57
57
|
licenses:
|
58
58
|
post_install_message:
|
@@ -77,8 +77,8 @@ requirements: []
|
|
77
77
|
rubyforge_project:
|
78
78
|
rubygems_version: 1.3.5
|
79
79
|
signing_key:
|
80
|
-
specification_version:
|
80
|
+
specification_version: 2
|
81
81
|
summary: A simple mailer gem
|
82
82
|
test_files:
|
83
|
-
- test/simpleMailer_test.rb
|
84
83
|
- test/test_helper.rb
|
84
|
+
- test/simpleMailer_test.rb
|