mail 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mail might be problematic. Click here for more details.
- data/Rakefile +10 -1
- data/lib/mail.rb +11 -6
- data/lib/mail/body.rb +24 -1
- data/lib/mail/core_extensions/nil.rb +1 -5
- data/lib/mail/core_extensions/string.rb +4 -8
- data/lib/mail/encodings/encodings.rb +2 -1
- data/lib/mail/message.rb +1 -0
- data/lib/mail/version.rb +1 -1
- metadata +3 -5
- data/lib/mail/core_extensions.rb +0 -6
- data/lib/mail/core_extensions/blank.rb +0 -41
data/Rakefile
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
environment = File.expand_path('../../vendor/gems/environment')
|
2
|
+
if File.exist?("#{environment}.rb")
|
3
|
+
require environment
|
4
|
+
end
|
5
|
+
|
1
6
|
require 'rake/rdoctask'
|
2
7
|
require 'rake/gempackagetask'
|
3
8
|
require 'rake/testtask'
|
@@ -7,7 +12,7 @@ require 'bundler'
|
|
7
12
|
|
8
13
|
spec = Gem::Specification.new do |s|
|
9
14
|
s.name = "mail"
|
10
|
-
s.version = "1.2.
|
15
|
+
s.version = "1.2.9"
|
11
16
|
s.author = "Mike Lindsaar"
|
12
17
|
s.email = "raasdnil@gmail.com"
|
13
18
|
s.homepage = "http://github.com/mikel/mail"
|
@@ -44,7 +49,11 @@ Spec::Rake::SpecTask.new(:rcov) do |t|
|
|
44
49
|
end
|
45
50
|
|
46
51
|
Spec::Rake::SpecTask.new(:spec) do |t|
|
52
|
+
t.warning = true
|
47
53
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
54
|
+
t.spec_opts = %w(--backtrace --diff --color)
|
55
|
+
t.libs << "#{File.dirname(__FILE__)}/spec"
|
56
|
+
t.libs << "#{File.dirname(__FILE__)}/spec/mail"
|
48
57
|
end
|
49
58
|
|
50
59
|
Rake::TestTask.new(:test) do |t|
|
data/lib/mail.rb
CHANGED
@@ -2,17 +2,15 @@
|
|
2
2
|
module Mail # :doc:
|
3
3
|
|
4
4
|
require 'date'
|
5
|
-
|
5
|
+
|
6
6
|
require 'treetop'
|
7
7
|
require 'active_support'
|
8
|
-
|
9
|
-
|
8
|
+
|
10
9
|
# Have to handle ActiveSupport 2.3 and 3.0
|
11
10
|
# Following two lines make sure that HashWithIndifferentAccess is available
|
12
11
|
# regardless of having activesupport 3 or 2.3 loaded
|
13
12
|
require 'active_support/core_ext/hash/indifferent_access'
|
14
|
-
|
15
|
-
|
13
|
+
|
16
14
|
require 'uri'
|
17
15
|
require 'net/smtp'
|
18
16
|
require 'mime/types'
|
@@ -29,7 +27,14 @@ module Mail # :doc:
|
|
29
27
|
end
|
30
28
|
|
31
29
|
require File.join(dir_name, 'version')
|
32
|
-
|
30
|
+
begin
|
31
|
+
require 'active_support/core_ext/object/blank'
|
32
|
+
rescue LoadError
|
33
|
+
# Unneeded for Active Support <= 3.0.pre
|
34
|
+
end
|
35
|
+
require File.join(dir_name, 'core_extensions/nil')
|
36
|
+
require File.join(dir_name, 'core_extensions/string')
|
37
|
+
|
33
38
|
require File.join(dir_name, 'patterns')
|
34
39
|
require File.join(dir_name, 'utilities')
|
35
40
|
require File.join(dir_name, 'configuration')
|
data/lib/mail/body.rb
CHANGED
@@ -32,9 +32,32 @@ module Mail
|
|
32
32
|
else
|
33
33
|
@raw_source = string
|
34
34
|
end
|
35
|
+
@encoding = nil
|
35
36
|
set_charset
|
36
37
|
end
|
37
38
|
|
39
|
+
# Matches this body with another body. Also matches the decoded value of this
|
40
|
+
# body with a string.
|
41
|
+
#
|
42
|
+
# Examples:
|
43
|
+
#
|
44
|
+
# body = Mail::Body.new('The body')
|
45
|
+
# body == body #=> true
|
46
|
+
#
|
47
|
+
# body = Mail::Body.new('The body')
|
48
|
+
# body == 'The body' #=> true
|
49
|
+
#
|
50
|
+
# body = Mail::Body.new("VGhlIGJvZHk=\n")
|
51
|
+
# body.encoding = 'base64'
|
52
|
+
# body == "The body" #=> true
|
53
|
+
def ==(other)
|
54
|
+
if other.class == String
|
55
|
+
self.decoded == other
|
56
|
+
else
|
57
|
+
self.eql?(other)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
38
61
|
# Returns the raw source that the body was initialized with, without
|
39
62
|
# any tampering
|
40
63
|
def raw_source
|
@@ -155,4 +178,4 @@ module Mail
|
|
155
178
|
raw_source.ascii_only? ? @charset = 'US-ASCII' : @charset = nil
|
156
179
|
end
|
157
180
|
end
|
158
|
-
end
|
181
|
+
end
|
@@ -1,23 +1,19 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
class String #:nodoc:
|
3
|
-
|
4
3
|
def to_crlf
|
5
|
-
|
4
|
+
gsub(/\n|\r\n|\r/) { "\r\n" }
|
6
5
|
end
|
7
6
|
|
8
7
|
def to_lf
|
9
|
-
|
8
|
+
gsub(/\n|\r\n|\r/) { "\n" }
|
10
9
|
end
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
unless method_defined?(:ascii_only?)
|
14
12
|
# Provides all strings with the Ruby 1.9 method of .ascii_only? and
|
15
13
|
# returns true or false
|
16
14
|
US_ASCII_REGEXP = %Q{\x00-\x7f}
|
17
15
|
def ascii_only?
|
18
16
|
!(self =~ /[^#{US_ASCII_REGEXP}]/)
|
19
17
|
end
|
20
|
-
|
21
18
|
end
|
22
|
-
|
23
|
-
end
|
19
|
+
end
|
@@ -116,6 +116,7 @@ module Mail
|
|
116
116
|
output
|
117
117
|
elsif original_encoding && to_encoding
|
118
118
|
begin
|
119
|
+
require 'iconv'
|
119
120
|
Iconv.iconv(to_encoding, original_encoding, output).first
|
120
121
|
rescue Iconv::IllegalSequence, Iconv::InvalidEncoding, Errno::EINVAL
|
121
122
|
# the 'from' parameter specifies a charset other than what the text
|
@@ -193,4 +194,4 @@ module Mail
|
|
193
194
|
end
|
194
195
|
|
195
196
|
end
|
196
|
-
end
|
197
|
+
end
|
data/lib/mail/message.rb
CHANGED
data/lib/mail/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Lindsaar
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-23 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 2.3.4
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: mime-types
|
@@ -69,10 +69,8 @@ files:
|
|
69
69
|
- lib/mail/attachment.rb
|
70
70
|
- lib/mail/body.rb
|
71
71
|
- lib/mail/configuration.rb
|
72
|
-
- lib/mail/core_extensions/blank.rb
|
73
72
|
- lib/mail/core_extensions/nil.rb
|
74
73
|
- lib/mail/core_extensions/string.rb
|
75
|
-
- lib/mail/core_extensions.rb
|
76
74
|
- lib/mail/elements/address.rb
|
77
75
|
- lib/mail/elements/address_list.rb
|
78
76
|
- lib/mail/elements/content_disposition_element.rb
|
data/lib/mail/core_extensions.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#:nodoc:
|
3
|
-
# From the nice guys at rubyonrails.org -> ActiveSupport
|
4
|
-
class ::Object
|
5
|
-
# An object is blank if it's nil, empty, or a whitespace string.
|
6
|
-
# For example, "", " ", nil, [], and {} are blank.
|
7
|
-
#
|
8
|
-
# This simplifies
|
9
|
-
# if !address.nil? && !address.empty?
|
10
|
-
# to
|
11
|
-
# if !address.blank?
|
12
|
-
def blank?
|
13
|
-
respond_to?(:empty?) ? empty? : !self
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class FalseClass #:nodoc:
|
18
|
-
def blank?
|
19
|
-
true
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class TrueClass #:nodoc:
|
24
|
-
def blank?
|
25
|
-
false
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class Array #:nodoc:
|
30
|
-
alias_method :blank?, :empty?
|
31
|
-
end
|
32
|
-
|
33
|
-
class Hash #:nodoc:
|
34
|
-
alias_method :blank?, :empty?
|
35
|
-
end
|
36
|
-
|
37
|
-
class Numeric #:nodoc:
|
38
|
-
def blank?
|
39
|
-
false
|
40
|
-
end
|
41
|
-
end
|