mail 2.1.5.3 → 2.2.0
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/CHANGELOG.rdoc +16 -0
- data/Rakefile +1 -1
- data/lib/mail.rb +3 -1
- data/lib/mail/body.rb +3 -2
- data/lib/mail/core_extensions/string.rb +4 -0
- data/lib/mail/elements/address.rb +3 -3
- data/lib/mail/elements/content_transfer_encoding_element.rb +1 -1
- data/lib/mail/encodings.rb +48 -8
- data/lib/mail/encodings/quoted_printable.rb +1 -14
- data/lib/mail/field.rb +44 -44
- data/lib/mail/fields/bcc_field.rb +3 -2
- data/lib/mail/fields/cc_field.rb +3 -2
- data/lib/mail/fields/comments_field.rb +3 -3
- data/lib/mail/fields/common/common_address.rb +19 -10
- data/lib/mail/fields/common/common_field.rb +6 -6
- data/lib/mail/fields/common/common_message_id.rb +1 -1
- data/lib/mail/fields/content_description_field.rb +3 -3
- data/lib/mail/fields/content_disposition_field.rb +3 -3
- data/lib/mail/fields/content_id_field.rb +6 -6
- data/lib/mail/fields/content_location_field.rb +3 -3
- data/lib/mail/fields/content_transfer_encoding_field.rb +6 -3
- data/lib/mail/fields/content_type_field.rb +8 -7
- data/lib/mail/fields/date_field.rb +8 -8
- data/lib/mail/fields/from_field.rb +3 -3
- data/lib/mail/fields/in_reply_to_field.rb +3 -2
- data/lib/mail/fields/keywords_field.rb +3 -2
- data/lib/mail/fields/message_id_field.rb +4 -3
- data/lib/mail/fields/mime_version_field.rb +5 -6
- data/lib/mail/fields/received_field.rb +3 -2
- data/lib/mail/fields/references_field.rb +3 -3
- data/lib/mail/fields/reply_to_field.rb +3 -3
- data/lib/mail/fields/resent_bcc_field.rb +3 -3
- data/lib/mail/fields/resent_cc_field.rb +3 -3
- data/lib/mail/fields/resent_date_field.rb +7 -7
- data/lib/mail/fields/resent_from_field.rb +3 -3
- data/lib/mail/fields/resent_message_id_field.rb +3 -3
- data/lib/mail/fields/resent_sender_field.rb +3 -3
- data/lib/mail/fields/resent_to_field.rb +3 -3
- data/lib/mail/fields/return_path_field.rb +3 -3
- data/lib/mail/fields/sender_field.rb +3 -3
- data/lib/mail/fields/structured_field.rb +12 -3
- data/lib/mail/fields/subject_field.rb +3 -2
- data/lib/mail/fields/to_field.rb +3 -3
- data/lib/mail/fields/unstructured_field.rb +68 -26
- data/lib/mail/header.rb +20 -4
- data/lib/mail/message.rb +36 -26
- data/lib/mail/parsers/content_disposition.rb +1 -1
- data/lib/mail/parsers/content_disposition.treetop +1 -1
- data/lib/mail/parsers/content_transfer_encoding.rb +1 -8
- data/lib/mail/parsers/content_transfer_encoding.treetop +1 -1
- data/lib/mail/parsers/content_type.rb +1 -1
- data/lib/mail/parsers/content_type.treetop +1 -1
- data/lib/mail/parsers/rfc2045.rb +6 -6
- data/lib/mail/parsers/rfc2045.treetop +1 -1
- data/lib/mail/parsers/rfc2822.rb +236 -236
- data/lib/mail/parsers/rfc2822.treetop +12 -12
- data/lib/mail/patterns.rb +6 -4
- data/lib/mail/utilities.rb +8 -5
- data/lib/mail/version.rb +3 -4
- metadata +16 -17
@@ -31,6 +31,14 @@ module Mail
|
|
31
31
|
[\x09\x20]
|
32
32
|
end
|
33
33
|
|
34
|
+
rule FWS # Folding white space
|
35
|
+
(WSP* CRLF WSP+) / (CRLF WSP+) / obs_FWS
|
36
|
+
end
|
37
|
+
|
38
|
+
rule CFWS
|
39
|
+
(FWS* comment)* FWS?
|
40
|
+
end
|
41
|
+
|
34
42
|
rule NO_WS_CTL
|
35
43
|
[\x01-\x08] / # US-ASCII control characters
|
36
44
|
[\x0B-\x0C] / # that do not include the
|
@@ -48,14 +56,6 @@ module Mail
|
|
48
56
|
DQUOTE
|
49
57
|
end
|
50
58
|
|
51
|
-
rule FWS # Folding white space
|
52
|
-
(WSP* CRLF WSP+) / (CRLF WSP+) / obs_FWS
|
53
|
-
end
|
54
|
-
|
55
|
-
rule CFWS
|
56
|
-
(FWS* comment)* FWS?
|
57
|
-
end
|
58
|
-
|
59
59
|
rule ctext
|
60
60
|
NO_WS_CTL / # Non white space controls
|
61
61
|
[\x21-\x27] / # The rest of the US-ASCII
|
@@ -128,6 +128,10 @@ module Mail
|
|
128
128
|
[\x47-\x5b] / # or the "." or the
|
129
129
|
[\x5d-\x7e] # double quote character
|
130
130
|
end
|
131
|
+
|
132
|
+
rule phrase
|
133
|
+
obs_phrase / word+
|
134
|
+
end
|
131
135
|
|
132
136
|
rule word
|
133
137
|
atom / quoted_string
|
@@ -136,10 +140,6 @@ module Mail
|
|
136
140
|
rule phrase_list
|
137
141
|
first_phrase:phrase other_phrases:("," FWS* phrase_value:phrase)*
|
138
142
|
end
|
139
|
-
|
140
|
-
rule phrase
|
141
|
-
obs_phrase / word+
|
142
|
-
end
|
143
143
|
|
144
144
|
rule domain_literal
|
145
145
|
CFWS? "[" (FWS? dcontent)* FWS? "]" CFWS?
|
data/lib/mail/patterns.rb
CHANGED
@@ -3,7 +3,7 @@ module Mail
|
|
3
3
|
white_space = %Q|\x9\x20|
|
4
4
|
text = %Q|\x1-\x8\xB\xC\xE-\x7f|
|
5
5
|
field_name = %Q|\x21-\x39\x3b-\x7e|
|
6
|
-
|
6
|
+
qp_safe = %Q|\x20-\x3c\x3e-\x7e|
|
7
7
|
|
8
8
|
aspecial = %Q|()<>[]:;@\\,."| # RFC5322
|
9
9
|
tspecial = %Q|()<>@,;:\\"/[]?=| # RFC2045
|
@@ -15,10 +15,12 @@ module Mail
|
|
15
15
|
FWS = /#{CRLF}#{WSP}*/
|
16
16
|
TEXT = /[#{text}]/ # + obs-text
|
17
17
|
FIELD_NAME = /[#{field_name}]+/
|
18
|
-
FIELD_BODY =
|
19
|
-
FIELD_LINE = /^[#{field_name}]+:\s
|
20
|
-
HEADER_LINE = /^([#{field_name}]+:\s
|
18
|
+
FIELD_BODY = /.+/
|
19
|
+
FIELD_LINE = /^[#{field_name}]+:\s*.+$/
|
20
|
+
HEADER_LINE = /^([#{field_name}]+:\s*.+)$/
|
21
21
|
|
22
|
+
QP_UNSAFE = /[^#{qp_safe}]/
|
23
|
+
QP_SAFE = /[#{qp_safe}]/
|
22
24
|
CONTROL_CHAR = /[#{control}]/n
|
23
25
|
ATOM_UNSAFE = /[#{Regexp.quote aspecial}#{control}#{lwsp}]/n
|
24
26
|
PHRASE_UNSAFE = /[#{Regexp.quote aspecial}#{control}]/n
|
data/lib/mail/utilities.rb
CHANGED
@@ -11,7 +11,7 @@ module Mail
|
|
11
11
|
# If the string supplied has ATOM unsafe characters in it, will return the string quoted
|
12
12
|
# in double quotes, otherwise returns the string unmodified
|
13
13
|
def quote_atom( str )
|
14
|
-
(
|
14
|
+
atom_safe?( str ) ? str : dquote(str)
|
15
15
|
end
|
16
16
|
|
17
17
|
# If the string supplied has PHRASE unsafe characters in it, will return the string quoted
|
@@ -38,7 +38,7 @@ module Mail
|
|
38
38
|
# If the string supplied has TOKEN unsafe characters in it, will return the string quoted
|
39
39
|
# in double quotes, otherwise returns the string unmodified
|
40
40
|
def quote_token( str )
|
41
|
-
(
|
41
|
+
token_safe?( str ) ? str : dquote(str)
|
42
42
|
end
|
43
43
|
|
44
44
|
# Wraps supplied string in double quotes unless it is already wrapped.
|
@@ -46,7 +46,8 @@ module Mail
|
|
46
46
|
# Additionally will escape any double quotation marks in the string with a single
|
47
47
|
# backslash in front of the '"' character.
|
48
48
|
def dquote( str )
|
49
|
-
|
49
|
+
match = str.match(/^"(.*)?"$/)
|
50
|
+
str = match[1] if match
|
50
51
|
# First remove all escaped double quotes:
|
51
52
|
str = str.gsub(/\\"/, '"')
|
52
53
|
# Then wrap and re-escape all double quotes
|
@@ -60,7 +61,8 @@ module Mail
|
|
60
61
|
# string = '"This is a string"'
|
61
62
|
# unquote(string) #=> 'This is a string'
|
62
63
|
def unquote( str )
|
63
|
-
|
64
|
+
match = str.match(/^"(.*?)"$/)
|
65
|
+
match ? match[1] : str
|
64
66
|
end
|
65
67
|
|
66
68
|
# Wraps a string in parenthesis and escapes any that are in the string itself.
|
@@ -79,7 +81,8 @@ module Mail
|
|
79
81
|
# str = '(This is a string)'
|
80
82
|
# unparen( str ) #=> 'This is a string'
|
81
83
|
def unparen( str )
|
82
|
-
|
84
|
+
match = str.match(/^\((.*?)\)$/)
|
85
|
+
match ? match[1] : str
|
83
86
|
end
|
84
87
|
|
85
88
|
# Escape parenthesies in a string
|
data/lib/mail/version.rb
CHANGED
metadata
CHANGED
@@ -4,10 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 2
|
7
|
-
-
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 2.1.5.3
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 2.2.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Mike Lindsaar
|
@@ -15,13 +14,13 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-04-11 00:00:00 +10:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
21
|
+
type: :runtime
|
22
22
|
name: activesupport
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
24
|
requirements:
|
26
25
|
- - ">="
|
27
26
|
- !ruby/object:Gem::Version
|
@@ -30,24 +29,24 @@ dependencies:
|
|
30
29
|
- 3
|
31
30
|
- 4
|
32
31
|
version: 2.3.4
|
33
|
-
|
34
|
-
|
32
|
+
requirement: *id001
|
33
|
+
prerelease: false
|
35
34
|
- !ruby/object:Gem::Dependency
|
35
|
+
type: :runtime
|
36
36
|
name: mime-types
|
37
|
-
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
38
|
requirements:
|
40
39
|
- - ">="
|
41
40
|
- !ruby/object:Gem::Version
|
42
41
|
segments:
|
43
42
|
- 0
|
44
43
|
version: "0"
|
45
|
-
|
46
|
-
|
44
|
+
requirement: *id002
|
45
|
+
prerelease: false
|
47
46
|
- !ruby/object:Gem::Dependency
|
47
|
+
type: :runtime
|
48
48
|
name: treetop
|
49
|
-
|
50
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
49
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
51
|
- - ">="
|
53
52
|
- !ruby/object:Gem::Version
|
@@ -56,8 +55,8 @@ dependencies:
|
|
56
55
|
- 4
|
57
56
|
- 5
|
58
57
|
version: 1.4.5
|
59
|
-
|
60
|
-
|
58
|
+
requirement: *id003
|
59
|
+
prerelease: false
|
61
60
|
description: A really Ruby Mail handler.
|
62
61
|
email: raasdnil@gmail.com
|
63
62
|
executables: []
|