mail 2.6.4.rc2 → 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +6 -0
- data/MIT-LICENSE +1 -1
- data/README.md +1 -1
- data/lib/mail.rb +1 -0
- data/lib/mail/attachments_list.rb +2 -0
- data/lib/mail/body.rb +1 -0
- data/lib/mail/check_delivery_params.rb +1 -0
- data/lib/mail/configuration.rb +1 -0
- data/lib/mail/constants.rb +1 -0
- data/lib/mail/core_extensions/smtp.rb +1 -0
- data/lib/mail/core_extensions/string.rb +1 -0
- data/lib/mail/core_extensions/string/access.rb +1 -0
- data/lib/mail/core_extensions/string/multibyte.rb +1 -0
- data/lib/mail/elements.rb +1 -0
- data/lib/mail/elements/address.rb +2 -2
- data/lib/mail/elements/address_list.rb +1 -0
- data/lib/mail/elements/content_disposition_element.rb +1 -0
- data/lib/mail/elements/content_location_element.rb +6 -5
- data/lib/mail/elements/content_transfer_encoding_element.rb +1 -0
- data/lib/mail/elements/content_type_element.rb +1 -0
- data/lib/mail/elements/date_time_element.rb +1 -0
- data/lib/mail/elements/envelope_from_element.rb +1 -0
- data/lib/mail/elements/message_ids_element.rb +7 -5
- data/lib/mail/elements/mime_version_element.rb +1 -0
- data/lib/mail/elements/phrase_list.rb +1 -0
- data/lib/mail/elements/received_element.rb +1 -0
- data/lib/mail/encodings.rb +1 -0
- data/lib/mail/encodings/7bit.rb +1 -0
- data/lib/mail/encodings/8bit.rb +1 -0
- data/lib/mail/encodings/base64.rb +1 -0
- data/lib/mail/encodings/binary.rb +1 -0
- data/lib/mail/encodings/quoted_printable.rb +1 -0
- data/lib/mail/encodings/transfer_encoding.rb +1 -0
- data/lib/mail/encodings/unix_to_unix.rb +1 -0
- data/lib/mail/envelope.rb +1 -0
- data/lib/mail/field.rb +1 -0
- data/lib/mail/field_list.rb +1 -0
- data/lib/mail/fields.rb +1 -0
- data/lib/mail/fields/bcc_field.rb +1 -0
- data/lib/mail/fields/cc_field.rb +1 -0
- data/lib/mail/fields/comments_field.rb +1 -0
- data/lib/mail/fields/common/address_container.rb +1 -0
- data/lib/mail/fields/common/common_address.rb +1 -0
- data/lib/mail/fields/common/common_date.rb +1 -0
- data/lib/mail/fields/common/common_field.rb +4 -1
- data/lib/mail/fields/common/common_message_id.rb +1 -0
- data/lib/mail/fields/common/parameter_hash.rb +1 -0
- data/lib/mail/fields/content_description_field.rb +1 -0
- data/lib/mail/fields/content_disposition_field.rb +2 -1
- data/lib/mail/fields/content_id_field.rb +1 -0
- data/lib/mail/fields/content_location_field.rb +1 -0
- data/lib/mail/fields/content_transfer_encoding_field.rb +1 -0
- data/lib/mail/fields/content_type_field.rb +2 -1
- data/lib/mail/fields/date_field.rb +1 -0
- data/lib/mail/fields/from_field.rb +1 -0
- data/lib/mail/fields/in_reply_to_field.rb +1 -0
- data/lib/mail/fields/keywords_field.rb +1 -0
- data/lib/mail/fields/message_id_field.rb +1 -0
- data/lib/mail/fields/mime_version_field.rb +1 -0
- data/lib/mail/fields/optional_field.rb +1 -0
- data/lib/mail/fields/received_field.rb +1 -0
- data/lib/mail/fields/references_field.rb +1 -0
- data/lib/mail/fields/reply_to_field.rb +1 -0
- data/lib/mail/fields/resent_bcc_field.rb +1 -0
- data/lib/mail/fields/resent_cc_field.rb +1 -0
- data/lib/mail/fields/resent_date_field.rb +1 -0
- data/lib/mail/fields/resent_from_field.rb +1 -0
- data/lib/mail/fields/resent_message_id_field.rb +1 -0
- data/lib/mail/fields/resent_sender_field.rb +1 -0
- data/lib/mail/fields/resent_to_field.rb +1 -0
- data/lib/mail/fields/return_path_field.rb +1 -0
- data/lib/mail/fields/sender_field.rb +1 -0
- data/lib/mail/fields/structured_field.rb +1 -0
- data/lib/mail/fields/subject_field.rb +1 -0
- data/lib/mail/fields/to_field.rb +1 -0
- data/lib/mail/fields/unstructured_field.rb +2 -1
- data/lib/mail/header.rb +1 -0
- data/lib/mail/indifferent_hash.rb +1 -0
- data/lib/mail/mail.rb +1 -0
- data/lib/mail/matchers/attachment_matchers.rb +1 -0
- data/lib/mail/matchers/has_sent_mail.rb +1 -0
- data/lib/mail/message.rb +1 -0
- data/lib/mail/multibyte.rb +1 -0
- data/lib/mail/multibyte/chars.rb +1 -0
- data/lib/mail/multibyte/exceptions.rb +1 -0
- data/lib/mail/multibyte/unicode.rb +1 -0
- data/lib/mail/multibyte/utils.rb +1 -0
- data/lib/mail/network.rb +1 -0
- data/lib/mail/network/delivery_methods/exim.rb +1 -0
- data/lib/mail/network/delivery_methods/file_delivery.rb +1 -0
- data/lib/mail/network/delivery_methods/sendmail.rb +1 -0
- data/lib/mail/network/delivery_methods/smtp.rb +1 -0
- data/lib/mail/network/delivery_methods/smtp_connection.rb +1 -0
- data/lib/mail/network/delivery_methods/test_mailer.rb +1 -0
- data/lib/mail/network/retriever_methods/base.rb +1 -0
- data/lib/mail/network/retriever_methods/imap.rb +1 -0
- data/lib/mail/network/retriever_methods/pop3.rb +1 -0
- data/lib/mail/network/retriever_methods/test_retriever.rb +1 -0
- data/lib/mail/parsers.rb +1 -0
- data/lib/mail/parsers/address_lists_parser.rb +1 -0
- data/lib/mail/parsers/content_disposition_parser.rb +1 -0
- data/lib/mail/parsers/content_location_parser.rb +1 -0
- data/lib/mail/parsers/content_transfer_encoding_parser.rb +1 -0
- data/lib/mail/parsers/content_type_parser.rb +1 -0
- data/lib/mail/parsers/date_time_parser.rb +3 -0
- data/lib/mail/parsers/envelope_from_parser.rb +1 -0
- data/lib/mail/parsers/message_ids_parser.rb +1 -0
- data/lib/mail/parsers/mime_version_parser.rb +1 -0
- data/lib/mail/parsers/phrase_lists_parser.rb +3 -0
- data/lib/mail/parsers/ragel.rb +1 -0
- data/lib/mail/parsers/received_parser.rb +2 -0
- data/lib/mail/part.rb +1 -0
- data/lib/mail/parts_list.rb +1 -0
- data/lib/mail/utilities.rb +27 -9
- data/lib/mail/version.rb +2 -1
- data/lib/mail/version_specific/ruby_1_8.rb +1 -0
- data/lib/mail/version_specific/ruby_1_9.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f91f133d2e44832ecef1cb4bfe9cc57391aedf84
|
4
|
+
data.tar.gz: 23d0cdbc09cdbaafee76b01d7c3820a6c0dfb6d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c788407da309561bee6a59ec746efeea7c0cc8633206eb2085f08ad6b161df92475109a988de748e554248d2ca47e6cd31c3fd0394d0eddac5950e7bb28783a8
|
7
|
+
data.tar.gz: 55b70f9d539420d254373c7abfccf6bc85228f34c38696086be363a36fb4f966415238aaa8e9ec9e6eed02207af2a3940b9f85c5f3076e735cd19e095764abc2
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
== HEAD
|
2
2
|
|
3
|
+
== Version 2.6.4 - Wed Mar 23 08:16 -0700 2016 Jeremy Daer <jeremydaer@gmail.com>
|
4
|
+
|
3
5
|
Features:
|
4
6
|
* #772 - Normalize encoding matchers (grosser)
|
5
7
|
* #775 - Avoid failed encodings / stop bad charsets early (grosser)
|
@@ -11,6 +13,10 @@ Features:
|
|
11
13
|
* #901 - Allow mail.text_part = '…' and mail.html_part = '<p>…</p>' (taavo)
|
12
14
|
* #924 - Matcher for having attachments (schepedw)
|
13
15
|
|
16
|
+
Performance:
|
17
|
+
* #956 - Use native String#encode for CR/LF conversion (carsonreinke)
|
18
|
+
* #970 - Support Ruby 2.3+ frozen string literals (twalpole)
|
19
|
+
|
14
20
|
Bugs:
|
15
21
|
* #719 - Fix to not extract header content that looks like its field name (kjg)
|
16
22
|
* #789 - Fix encoding collapsing not dealing with multiple encodings in 1 line (grosser)
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -697,7 +697,7 @@ License
|
|
697
697
|
|
698
698
|
(The MIT License)
|
699
699
|
|
700
|
-
Copyright (c) 2009-
|
700
|
+
Copyright (c) 2009-2016 Mikel Lindsaar
|
701
701
|
|
702
702
|
Permission is hereby granted, free of charge, to any person obtaining
|
703
703
|
a copy of this software and associated documentation files (the
|
data/lib/mail.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Mail
|
2
3
|
class AttachmentsList < Array
|
3
4
|
|
@@ -71,6 +72,7 @@ module Mail
|
|
71
72
|
|
72
73
|
if hash[:body].respond_to? :force_encoding and hash[:body].respond_to? :valid_encoding?
|
73
74
|
if not hash[:body].valid_encoding? and default_values[:content_transfer_encoding].downcase == "binary"
|
75
|
+
hash[:body] = hash[:body].dup if hash[:body].frozen?
|
74
76
|
hash[:body].force_encoding("BINARY")
|
75
77
|
end
|
76
78
|
end
|
data/lib/mail/body.rb
CHANGED
data/lib/mail/configuration.rb
CHANGED
data/lib/mail/constants.rb
CHANGED
data/lib/mail/elements.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
module Mail
|
3
4
|
class Address
|
4
5
|
|
@@ -92,7 +93,7 @@ module Mail
|
|
92
93
|
# a.display_name = 'Mikel Lindsaar'
|
93
94
|
# a.format #=> 'Mikel Lindsaar <mikel@test.lindsaar.net>'
|
94
95
|
def display_name=( str )
|
95
|
-
@display_name = str
|
96
|
+
@display_name = str.dup # in case frozen
|
96
97
|
end
|
97
98
|
|
98
99
|
# Returns the local part (the left hand side of the @ sign in the email address) of
|
@@ -209,7 +210,6 @@ module Mail
|
|
209
210
|
elsif @data.comments && @data.domain
|
210
211
|
str = strip_domain_comments(format_comments)
|
211
212
|
end
|
212
|
-
|
213
213
|
str unless Utilities.blank?(str)
|
214
214
|
end
|
215
215
|
|
@@ -1,21 +1,22 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
module Mail
|
3
4
|
class ContentLocationElement # :nodoc:
|
4
|
-
|
5
|
+
|
5
6
|
include Mail::Utilities
|
6
|
-
|
7
|
+
|
7
8
|
def initialize( string )
|
8
9
|
content_location = Mail::Parsers::ContentLocationParser.new.parse(string)
|
9
10
|
@location = content_location.location
|
10
11
|
end
|
11
|
-
|
12
|
+
|
12
13
|
def location
|
13
14
|
@location
|
14
15
|
end
|
15
|
-
|
16
|
+
|
16
17
|
def to_s(*args)
|
17
18
|
location.to_s
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
end
|
21
22
|
end
|
@@ -1,21 +1,23 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
module Mail
|
3
4
|
class MessageIdsElement
|
4
|
-
|
5
|
+
|
5
6
|
include Mail::Utilities
|
6
|
-
|
7
|
+
|
7
8
|
def initialize(string)
|
9
|
+
raise Mail::Field::ParseError.new(Mail::MessageIdsElement, string, 'nil is invalid') if string.nil?
|
8
10
|
@message_ids = Mail::Parsers::MessageIdsParser.new.parse(string).message_ids.map { |msg_id| clean_msg_id(msg_id) }
|
9
11
|
end
|
10
|
-
|
12
|
+
|
11
13
|
def message_ids
|
12
14
|
@message_ids
|
13
15
|
end
|
14
|
-
|
16
|
+
|
15
17
|
def message_id
|
16
18
|
@message_ids.first
|
17
19
|
end
|
18
|
-
|
20
|
+
|
19
21
|
def clean_msg_id( val )
|
20
22
|
val =~ /.*<(.*)>.*/ ; $1
|
21
23
|
end
|
data/lib/mail/encodings.rb
CHANGED
data/lib/mail/encodings/7bit.rb
CHANGED
data/lib/mail/encodings/8bit.rb
CHANGED
data/lib/mail/envelope.rb
CHANGED
data/lib/mail/field.rb
CHANGED
data/lib/mail/field_list.rb
CHANGED
data/lib/mail/fields.rb
CHANGED
data/lib/mail/fields/cc_field.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
module Mail
|
3
4
|
module CommonField # :nodoc:
|
4
5
|
include Mail::Constants
|
@@ -51,7 +52,9 @@ module Mail
|
|
51
52
|
FILENAME_RE = /\b(filename|name)=([^;"\r\n]+\s[^;"\r\n]+)/
|
52
53
|
def ensure_filename_quoted(value)
|
53
54
|
if value.is_a?(String)
|
54
|
-
value.sub
|
55
|
+
value.sub FILENAME_RE, '\1="\2"'
|
56
|
+
else
|
57
|
+
value
|
55
58
|
end
|
56
59
|
end
|
57
60
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'mail/fields/common/parameter_hash'
|
3
4
|
|
4
5
|
module Mail
|
@@ -9,7 +10,7 @@ module Mail
|
|
9
10
|
|
10
11
|
def initialize(value = nil, charset = 'utf-8')
|
11
12
|
self.charset = charset
|
12
|
-
ensure_filename_quoted(value)
|
13
|
+
value = ensure_filename_quoted(value)
|
13
14
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
14
15
|
self.parse
|
15
16
|
self
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'mail/fields/common/parameter_hash'
|
3
4
|
|
4
5
|
module Mail
|
@@ -19,7 +20,7 @@ module Mail
|
|
19
20
|
@parameters = nil
|
20
21
|
value = strip_field(FIELD_NAME, value)
|
21
22
|
end
|
22
|
-
ensure_filename_quoted(value)
|
23
|
+
value = ensure_filename_quoted(value)
|
23
24
|
super(CAPITALIZED_FIELD, value, charset)
|
24
25
|
self.parse
|
25
26
|
self
|
data/lib/mail/fields/to_field.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'mail/fields/common/common_field'
|
3
4
|
|
4
5
|
module Mail
|
@@ -127,7 +128,7 @@ module Mail
|
|
127
128
|
if first
|
128
129
|
first = !first
|
129
130
|
else
|
130
|
-
word = " "
|
131
|
+
word = " #{word}"
|
131
132
|
end
|
132
133
|
if word.not_ascii_only?
|
133
134
|
word
|
data/lib/mail/header.rb
CHANGED
data/lib/mail/mail.rb
CHANGED
data/lib/mail/message.rb
CHANGED
data/lib/mail/multibyte.rb
CHANGED
data/lib/mail/multibyte/chars.rb
CHANGED
data/lib/mail/multibyte/utils.rb
CHANGED
data/lib/mail/network.rb
CHANGED
data/lib/mail/parsers.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Mail::Parsers
|
2
3
|
class DateTimeParser
|
3
4
|
include Mail::Utilities
|
4
5
|
|
5
6
|
def parse(s)
|
7
|
+
raise Mail::Field::ParseError.new(Mail::DateTimeElement, s, "nil is an invalid DateTime") if s.nil?
|
8
|
+
|
6
9
|
date_time = DateTimeStruct.new([])
|
7
10
|
|
8
11
|
actions, error = Ragel.parse(:date_time, s)
|
@@ -1,7 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Mail::Parsers
|
2
3
|
class PhraseListsParser
|
3
4
|
|
4
5
|
def parse(s)
|
6
|
+
raise Mail::Field::ParseError.new(Mail::PhraseList, s, 'nil is invalid') if s.nil?
|
7
|
+
|
5
8
|
actions, error = Ragel.parse(:phrase_lists, s)
|
6
9
|
if error
|
7
10
|
raise Mail::Field::ParseError.new(Mail::PhraseList, s, error)
|
data/lib/mail/parsers/ragel.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Mail::Parsers
|
2
3
|
class ReceivedParser
|
3
4
|
|
4
5
|
def parse(s)
|
6
|
+
raise Mail::Field::ParseError.new(Mail::ReceivedElement, s, 'nil is invalid') if s.nil?
|
5
7
|
actions, error = Ragel.parse(:received, s)
|
6
8
|
if error
|
7
9
|
raise Mail::Field::ParseError.new(Mail::ReceivedElement, s, error)
|
data/lib/mail/part.rb
CHANGED
data/lib/mail/parts_list.rb
CHANGED
data/lib/mail/utilities.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
module Mail
|
3
4
|
module Utilities
|
4
5
|
|
@@ -23,13 +24,11 @@ module Mail
|
|
23
24
|
def quote_phrase( str )
|
24
25
|
if RUBY_VERSION >= '1.9'
|
25
26
|
original_encoding = str.encoding
|
26
|
-
str.force_encoding('ASCII-8BIT')
|
27
|
-
if (PHRASE_UNSAFE ===
|
28
|
-
|
29
|
-
str.force_encoding(original_encoding)
|
30
|
-
quoted_str
|
27
|
+
ascii_str = str.dup.force_encoding('ASCII-8BIT')
|
28
|
+
if (PHRASE_UNSAFE === ascii_str)
|
29
|
+
dquote(ascii_str).force_encoding(original_encoding)
|
31
30
|
else
|
32
|
-
str
|
31
|
+
str
|
33
32
|
end
|
34
33
|
else
|
35
34
|
(PHRASE_UNSAFE === str) ? dquote(str) : str
|
@@ -223,7 +222,26 @@ module Mail
|
|
223
222
|
enum.each_with_index.map(&block)
|
224
223
|
end
|
225
224
|
|
226
|
-
|
225
|
+
end
|
226
|
+
|
227
|
+
# Test String#encode works correctly with line endings.
|
228
|
+
# Some versions of Ruby (e.g. MRI <1.9, JRuby, Rubinius) line ending
|
229
|
+
# normalization does not work correctly or did not have #encode.
|
230
|
+
if ("\r".encode(:universal_newline => true) rescue nil) == LF &&
|
231
|
+
(LF.encode(:crlf_newline => true) rescue nil) == CRLF
|
232
|
+
# Using String#encode is better performing than Regexp
|
233
|
+
|
234
|
+
def self.to_lf(input)
|
235
|
+
input.kind_of?(String) ? input.to_str.encode(input.encoding, :universal_newline => true) : ''
|
236
|
+
end
|
237
|
+
|
238
|
+
def self.to_crlf(input)
|
239
|
+
input.kind_of?(String) ? input.to_str.encode(input.encoding, :universal_newline => true).encode!(input.encoding, :crlf_newline => true) : ''
|
240
|
+
end
|
241
|
+
|
242
|
+
else
|
243
|
+
|
244
|
+
def self.to_lf(input)
|
227
245
|
input.kind_of?(String) ? input.to_str.gsub(/\r\n|\r/, LF) : ''
|
228
246
|
end
|
229
247
|
|
@@ -236,7 +254,7 @@ module Mail
|
|
236
254
|
CRLF_REGEX = /\n|\r\n|\r/
|
237
255
|
end
|
238
256
|
|
239
|
-
def self.to_crlf
|
257
|
+
def self.to_crlf(input)
|
240
258
|
input.kind_of?(String) ? input.to_str.gsub(CRLF_REGEX, CRLF) : ''
|
241
259
|
end
|
242
260
|
|
@@ -245,7 +263,7 @@ module Mail
|
|
245
263
|
# Returns true if the object is considered blank.
|
246
264
|
# A blank includes things like '', ' ', nil,
|
247
265
|
# and arrays and hashes that have nothing in them.
|
248
|
-
#
|
266
|
+
#
|
249
267
|
# This logic is mostly shared with ActiveSupport's blank?
|
250
268
|
def self.blank?(value)
|
251
269
|
if value.kind_of?(NilClass)
|
data/lib/mail/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.4
|
4
|
+
version: 2.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikel Lindsaar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -264,9 +264,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
264
264
|
version: '0'
|
265
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
266
266
|
requirements:
|
267
|
-
- - "
|
267
|
+
- - ">="
|
268
268
|
- !ruby/object:Gem::Version
|
269
|
-
version:
|
269
|
+
version: '0'
|
270
270
|
requirements: []
|
271
271
|
rubyforge_project:
|
272
272
|
rubygems_version: 2.5.1
|