mailit 2010.06.03 → 2011.01.27
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +2 -1
- data/CHANGELOG +51 -25
- data/lib/mailit/mail.rb +5 -4
- data/lib/mailit/mailer.rb +1 -1
- data/lib/mailit/version.rb +1 -1
- data/mailit.gemspec +2 -2
- data/spec/helper.rb +1 -1
- data/spec/mailit/mail.rb +5 -6
- data/spec/mailit/mailer.rb +17 -1
- data/tasks/bacon.rake +1 -1
- metadata +5 -8
data/AUTHORS
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
Following persons have contributed to mailit.
|
2
2
|
(Sorted by number of submitted patches, then alphabetically)
|
3
3
|
|
4
|
-
|
4
|
+
22 Michael Fellinger <mf@rubyists.com>
|
5
5
|
3 Tobias Matthies <tm@mit2m.de>
|
6
6
|
2 Jake Douglas <jakecdouglas@gmail.com>
|
7
|
+
2 Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
|
7
8
|
1 Julian Langschaedel <meta.rb@gmail.com>
|
8
9
|
1 Kevin Berry <kb@rubyists.com>
|
data/CHANGELOG
CHANGED
@@ -1,106 +1,132 @@
|
|
1
|
-
[
|
1
|
+
[223dc17 | 2011-01-27 15:19:48 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
2
|
+
|
3
|
+
* Version 2011.01.27
|
4
|
+
|
5
|
+
[39a7001 | 2011-01-27 15:19:21 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
6
|
+
|
7
|
+
* Some spec fixes
|
8
|
+
|
9
|
+
[3e02a21 | 2011-01-27 15:19:02 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
10
|
+
|
11
|
+
* Fixes to quoting
|
12
|
+
|
13
|
+
[4fc3345 | 2011-01-27 15:18:47 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
14
|
+
|
15
|
+
* Fix typos in docs
|
16
|
+
|
17
|
+
[1a67240 | 2010-08-19 13:32:36 UTC] Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
|
18
|
+
|
19
|
+
* Fixed mailer to allow sending emails without SMTP authentication.
|
20
|
+
|
21
|
+
You need to set username, password ant auth_type to nil.
|
22
|
+
|
23
|
+
[656e233 | 2010-08-19 13:23:27 UTC] Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
|
24
|
+
|
25
|
+
* Fixed bacon tests to work under ruby 1.9.2.
|
26
|
+
|
27
|
+
[07a1b52 | 2010-06-04 00:55:57 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
2
28
|
|
3
29
|
* Version 2010.06
|
4
30
|
|
5
|
-
[990f3d6 | 2010-06-
|
31
|
+
[990f3d6 | 2010-06-04 00:55:47 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
6
32
|
|
7
33
|
* Bring the tasks up to date
|
8
34
|
|
9
|
-
[071eedd | 2010-06-02
|
35
|
+
[071eedd | 2010-06-02 20:10:22 UTC] Tobias Matthies <tm@mit2m.de>
|
10
36
|
|
11
37
|
* Fixed headers_prepare
|
12
38
|
|
13
|
-
[be7efc5 | 2010-06-02
|
39
|
+
[be7efc5 | 2010-06-02 20:09:34 UTC] Tobias Matthies <tm@mit2m.de>
|
14
40
|
|
15
41
|
* Added basic attachment tests
|
16
42
|
|
17
|
-
[75b28b3 | 2010-06-
|
43
|
+
[75b28b3 | 2010-06-02 10:40:55 UTC] Tobias Matthies <tm@mit2m.de>
|
18
44
|
|
19
45
|
* Fixed mime-type detection
|
20
46
|
|
21
|
-
[84e4be5 | 2009-09-
|
47
|
+
[84e4be5 | 2009-09-29 11:19:29 UTC] Julian Langschaedel <meta.rb@gmail.com>
|
22
48
|
|
23
49
|
* fix mailit/mailer.rb spec
|
24
50
|
|
25
51
|
did open a real connection in specs. changed to MockSMTP, instead.
|
26
52
|
|
27
|
-
[b2de414 | 2009-08-26
|
53
|
+
[b2de414 | 2009-08-26 16:02:11 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
28
54
|
|
29
55
|
* Rerelease for gemspec
|
30
56
|
|
31
|
-
[78c844d | 2009-08-
|
57
|
+
[78c844d | 2009-08-26 04:40:40 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
32
58
|
|
33
59
|
* Another fix
|
34
60
|
|
35
|
-
[fb25c19 | 2009-08-
|
61
|
+
[fb25c19 | 2009-08-26 04:40:01 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
36
62
|
|
37
63
|
* Version 2009.08
|
38
64
|
|
39
|
-
[2e6d77a | 2009-08-
|
65
|
+
[2e6d77a | 2009-08-26 04:38:53 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
40
66
|
|
41
67
|
* Fix Rakefile
|
42
68
|
|
43
|
-
[585554d | 2009-08-
|
69
|
+
[585554d | 2009-08-25 12:11:42 UTC] Kevin Berry <kevin@opensourcealchemist.com>
|
44
70
|
|
45
71
|
* Take in Pistos's patch, make my own patch to get running for current project, and add seedling structure.
|
46
72
|
|
47
|
-
[db73002 | 2009-08-
|
73
|
+
[db73002 | 2009-08-06 13:50:35 UTC] Jake Douglas <jakecdouglas@gmail.com>
|
48
74
|
|
49
75
|
* NetSMTP and EventMachine version both actually send mail now. Previous configuration didn't override the #send method correctly so the EM methods weren't loaded. The EM module may only be included now, not used with extend.
|
50
76
|
|
51
77
|
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
52
78
|
|
53
|
-
[9a36e2f | 2009-08-
|
79
|
+
[9a36e2f | 2009-08-06 12:39:26 UTC] Jake Douglas <jakecdouglas@gmail.com>
|
54
80
|
|
55
81
|
* get the value of :noop from the options hash in NetSmtp#send
|
56
82
|
|
57
83
|
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
58
84
|
|
59
|
-
[c6da60b | 2009-06-08
|
85
|
+
[c6da60b | 2009-06-08 20:52:33 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
60
86
|
|
61
87
|
* Release new version
|
62
88
|
|
63
|
-
[185cf45 | 2009-06-08
|
89
|
+
[185cf45 | 2009-06-08 20:51:07 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
64
90
|
|
65
91
|
* Fix long outstanding issues
|
66
92
|
|
67
|
-
[e429f3b | 2009-04-12
|
93
|
+
[e429f3b | 2009-04-12 20:38:16 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
68
94
|
|
69
95
|
* Major refactor of Mailer, add support for EventMachine::SmtpClient and remove render_send
|
70
96
|
|
71
|
-
[341d76a | 2009-04-12
|
97
|
+
[341d76a | 2009-04-12 20:23:33 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
72
98
|
|
73
99
|
* Make Mail#header_string and Mail#body_string public
|
74
100
|
|
75
|
-
[5716124 | 2009-03-15
|
101
|
+
[5716124 | 2009-03-15 20:26:27 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
76
102
|
|
77
103
|
* Add auth_type and username options for Mailer#send, should work on windows now
|
78
104
|
|
79
|
-
[ff38041 | 2009-03-
|
105
|
+
[ff38041 | 2009-03-11 03:02:58 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
80
106
|
|
81
107
|
* Add gemspec
|
82
108
|
|
83
|
-
[07b92d0 | 2009-03-
|
109
|
+
[07b92d0 | 2009-03-11 02:49:36 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
84
110
|
|
85
111
|
* Add Mailit::Mime - detects and uses available mime providers
|
86
112
|
|
87
|
-
[584398c | 2009-03-
|
113
|
+
[584398c | 2009-03-11 02:48:49 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
88
114
|
|
89
115
|
* Little improvment to style
|
90
116
|
|
91
|
-
[194c990 | 2009-03-
|
117
|
+
[194c990 | 2009-03-11 02:19:08 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
92
118
|
|
93
119
|
* Add warning if no mime-type detection is possible
|
94
120
|
|
95
|
-
[184b20d | 2009-03-
|
121
|
+
[184b20d | 2009-03-11 02:18:54 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
96
122
|
|
97
123
|
* Add Version
|
98
124
|
|
99
|
-
[74e9ca3 | 2009-03-
|
125
|
+
[74e9ca3 | 2009-03-11 02:18:35 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
100
126
|
|
101
127
|
* Add readme
|
102
128
|
|
103
|
-
[0a4bcad | 2009-03-
|
129
|
+
[0a4bcad | 2009-03-11 02:02:28 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
104
130
|
|
105
131
|
* Initial commit
|
106
132
|
|
data/lib/mailit/mail.rb
CHANGED
@@ -25,9 +25,9 @@ module Mailit
|
|
25
25
|
# mail = Mailit::Mail.new
|
26
26
|
# mail.to = 'test@test.com'
|
27
27
|
# mail.from = 'sender@sender.com'
|
28
|
-
# mail.subject 'Here are some files for you!'
|
28
|
+
# mail.subject = 'Here are some files for you!'
|
29
29
|
# mail.text = 'This is what people with plain text mail readers will see'
|
30
|
-
# mail.html =
|
30
|
+
# mail.html = 'A little something <b>special</b> for people with HTML readers'
|
31
31
|
# mail.attach('/etc/fstab')
|
32
32
|
# mail.attach('/home/manveru/.vimrc')
|
33
33
|
#
|
@@ -73,7 +73,7 @@ BODY
|
|
73
73
|
:date => true,
|
74
74
|
:message_id => lambda{|mail|
|
75
75
|
time = Time.now
|
76
|
-
domain = mail['from'].first.to_s
|
76
|
+
domain = mail['from'].first.to_s[/@[^>]+/] || 'localhost'
|
77
77
|
message_id = "<%f.%d.%d@%s>" % [time, $$, time.object_id, domain]
|
78
78
|
}
|
79
79
|
}
|
@@ -267,6 +267,7 @@ BODY
|
|
267
267
|
return unless text
|
268
268
|
|
269
269
|
if text.respond_to?(:force_encoding)
|
270
|
+
return text if text.ascii_only?
|
270
271
|
text = text.dup.force_encoding(Encoding::ASCII_8BIT)
|
271
272
|
end
|
272
273
|
|
@@ -282,8 +283,8 @@ BODY
|
|
282
283
|
when Array
|
283
284
|
address.map{|addr| quote_address_if_necessary(addr, charset) }
|
284
285
|
when /^(\S.*)\s+(<.*>)$/
|
285
|
-
phrase = $1.gsub(/^['"](.*)['"]$/, '\1')
|
286
286
|
address = $2
|
287
|
+
phrase = $1.gsub(/^['"](.*)['"]$/, '\1')
|
287
288
|
|
288
289
|
phrase = quote_if_necessary(phrase, charset, true)
|
289
290
|
|
data/lib/mailit/mailer.rb
CHANGED
@@ -65,7 +65,7 @@ module Mailit
|
|
65
65
|
|
66
66
|
server, port, domain, username, password, auth_type, noop =
|
67
67
|
settings(override, :server, :port, :domain, :username, :password, :auth_type, :noop)
|
68
|
-
username = mail.from.to_s if username.empty?
|
68
|
+
username = mail.from.to_s if !username.nil? && username.empty?
|
69
69
|
|
70
70
|
mailer.start(server, port, domain, username, password, auth_type) do |smtp|
|
71
71
|
return if noop
|
data/lib/mailit/version.rb
CHANGED
data/mailit.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{mailit}
|
5
|
-
s.version = "
|
5
|
+
s.version = "2011.01.27"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Michael 'manveru' Fellinger"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2011-01-27}
|
10
10
|
s.email = %q{manveru@rubyists.com}
|
11
11
|
s.files = ["AUTHORS", "CHANGELOG", "MANIFEST", "README.md", "Rakefile", "lib/mailit.rb", "lib/mailit/mail.rb", "lib/mailit/mailer.rb", "lib/mailit/mime.rb", "lib/mailit/version.rb", "lib/version.rb", "mailit.gemspec", "spec/helper.rb", "spec/mailit/mail.rb", "spec/mailit/mailer.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/copyright.rake", "tasks/gem.rake", "tasks/gem_installer.rake", "tasks/install_dependencies.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/yard.rake"]
|
12
12
|
s.homepage = %q{http://github.com/manveru/mailit}
|
data/spec/helper.rb
CHANGED
data/spec/mailit/mail.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Encoding: UTF-8
|
2
|
-
require '
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'helper'))
|
3
3
|
|
4
4
|
# The specs are translated from the Test::Unit tests of MailFactory.
|
5
5
|
#
|
@@ -101,11 +101,11 @@ describe Mailit::Mail do
|
|
101
101
|
mail.to = "test@test.com"
|
102
102
|
mail.from = "test@othertest.com"
|
103
103
|
mail.subject = "some html"
|
104
|
-
mail.html =
|
104
|
+
mail.html = '<a href="http://google.com">click here</a>'
|
105
105
|
|
106
106
|
mail.to_s.should.include('<a href=3D"http://google.com">click here</a>')
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
should 'make mail with a single attachment' do
|
110
110
|
mail = Mailit::Mail.new
|
111
111
|
tempfile = Tempfile.new('adw')
|
@@ -115,7 +115,7 @@ describe Mailit::Mail do
|
|
115
115
|
mail.attachments.first[:attachment].should.be == tempfile.read
|
116
116
|
mail.attachments.first[:filename].should == Pathname.new(tempfile.path).basename
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
should 'make mail with a single attachment and given filename' do
|
120
120
|
mail = Mailit::Mail.new
|
121
121
|
tempfile = Tempfile.new('adw')
|
@@ -126,7 +126,7 @@ describe Mailit::Mail do
|
|
126
126
|
mail.attachments.first[:attachment].should.be == tempfile.read
|
127
127
|
mail.attachments.first[:filename].should == filename
|
128
128
|
end
|
129
|
-
|
129
|
+
|
130
130
|
should 'make mail with multiple attachments and given filenames' do
|
131
131
|
mail = Mailit::Mail.new
|
132
132
|
tempfile1 = Tempfile.new('adw')
|
@@ -143,5 +143,4 @@ describe Mailit::Mail do
|
|
143
143
|
mail.attachments[1][:attachment].should.be == tempfile2.read
|
144
144
|
mail.attachments[1][:filename].should == tempfile2_filename
|
145
145
|
end
|
146
|
-
|
147
146
|
end
|
data/spec/mailit/mailer.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'helper'))
|
2
2
|
|
3
3
|
class MockSMTP
|
4
4
|
INSTANCES = []
|
@@ -45,4 +45,20 @@ describe Mailit::Mailer do
|
|
45
45
|
]
|
46
46
|
mock.send_message_args.should == [mail.to_s, mail.from, mail.to]
|
47
47
|
end
|
48
|
+
|
49
|
+
it 'sends a mail without authentication' do
|
50
|
+
mail = Mailit::Mail.new
|
51
|
+
mailer = Mailit::Mailer.new
|
52
|
+
|
53
|
+
mailer.send(mail, :server => 'smtp.example.com', :port => 25,
|
54
|
+
:domain => 'example.com', :username => nil, :password => nil,
|
55
|
+
:auth_type => nil, :mailer => MockSMTP)
|
56
|
+
|
57
|
+
mock = MockSMTP::INSTANCES.last
|
58
|
+
mock.start_args.should == [
|
59
|
+
'smtp.example.com', 25,
|
60
|
+
'example.com',
|
61
|
+
nil, nil, nil
|
62
|
+
]
|
63
|
+
end
|
48
64
|
end
|
data/tasks/bacon.rake
CHANGED
@@ -23,7 +23,7 @@ task :bacon => :install_dependencies do
|
|
23
23
|
specs.each_with_index do |spec, idx|
|
24
24
|
print(left_format % [idx + 1, specs_size, spec])
|
25
25
|
|
26
|
-
Open3.popen3(RUBY, spec) do |sin, sout, serr|
|
26
|
+
Open3.popen3(RUBY, File.join(File.dirname(__FILE__), '..', spec)) do |sin, sout, serr|
|
27
27
|
out = sout.read.strip
|
28
28
|
err = serr.read.strip
|
29
29
|
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 16081
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version:
|
6
|
+
- 2011
|
7
|
+
- 1
|
8
|
+
- 27
|
9
|
+
version: 2011.01.27
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Michael 'manveru' Fellinger
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2011-01-27 00:00:00 -06:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -70,7 +69,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
69
|
requirements:
|
71
70
|
- - ">="
|
72
71
|
- !ruby/object:Gem::Version
|
73
|
-
hash: 3
|
74
72
|
segments:
|
75
73
|
- 0
|
76
74
|
version: "0"
|
@@ -79,7 +77,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
77
|
requirements:
|
80
78
|
- - ">="
|
81
79
|
- !ruby/object:Gem::Version
|
82
|
-
hash: 3
|
83
80
|
segments:
|
84
81
|
- 0
|
85
82
|
version: "0"
|