mail 2.5.2 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.rdoc +124 -0
- data/CONTRIBUTING.md +21 -6
- data/Dependencies.txt +0 -1
- data/Gemfile +7 -22
- data/MIT-LICENSE +20 -0
- data/README.md +86 -31
- data/Rakefile +11 -22
- data/lib/mail/attachments_list.rb +4 -2
- data/lib/mail/body.rb +36 -11
- data/lib/mail/check_delivery_params.rb +13 -22
- data/lib/mail/configuration.rb +1 -0
- data/lib/mail/{patterns.rb → constants.rb} +29 -6
- data/lib/mail/core_extensions/smtp.rb +13 -13
- data/lib/mail/core_extensions/string/access.rb +1 -0
- data/lib/mail/core_extensions/string/multibyte.rb +1 -0
- data/lib/mail/core_extensions/string.rb +5 -17
- data/lib/mail/elements/address.rb +86 -145
- data/lib/mail/elements/address_list.rb +10 -42
- data/lib/mail/elements/content_disposition_element.rb +4 -7
- data/lib/mail/elements/content_location_element.rb +8 -11
- data/lib/mail/elements/content_transfer_encoding_element.rb +4 -10
- data/lib/mail/elements/content_type_element.rb +5 -8
- data/lib/mail/elements/date_time_element.rb +4 -7
- data/lib/mail/elements/envelope_from_element.rb +19 -13
- data/lib/mail/elements/message_ids_element.rb +8 -11
- data/lib/mail/elements/mime_version_element.rb +4 -7
- data/lib/mail/elements/phrase_list.rb +3 -7
- data/lib/mail/elements/received_element.rb +4 -7
- data/lib/mail/elements.rb +1 -0
- data/lib/mail/encodings/7bit.rb +1 -0
- data/lib/mail/encodings/8bit.rb +8 -2
- data/lib/mail/encodings/base64.rb +7 -1
- data/lib/mail/encodings/binary.rb +1 -0
- data/lib/mail/encodings/quoted_printable.rb +11 -4
- data/lib/mail/encodings/transfer_encoding.rb +27 -17
- data/lib/mail/encodings/unix_to_unix.rb +18 -0
- data/lib/mail/encodings.rb +54 -39
- data/lib/mail/envelope.rb +1 -5
- data/lib/mail/field.rb +81 -31
- data/lib/mail/field_list.rb +19 -18
- data/lib/mail/fields/bcc_field.rb +17 -5
- data/lib/mail/fields/cc_field.rb +3 -3
- data/lib/mail/fields/comments_field.rb +2 -1
- data/lib/mail/fields/common/address_container.rb +1 -0
- data/lib/mail/fields/common/common_address.rb +34 -28
- data/lib/mail/fields/common/common_date.rb +2 -8
- data/lib/mail/fields/common/common_field.rb +9 -5
- data/lib/mail/fields/common/common_message_id.rb +3 -2
- data/lib/mail/fields/common/parameter_hash.rb +4 -3
- data/lib/mail/fields/content_description_field.rb +1 -0
- data/lib/mail/fields/content_disposition_field.rb +13 -12
- data/lib/mail/fields/content_id_field.rb +4 -4
- data/lib/mail/fields/content_location_field.rb +2 -1
- data/lib/mail/fields/content_transfer_encoding_field.rb +4 -9
- data/lib/mail/fields/content_type_field.rb +4 -3
- data/lib/mail/fields/date_field.rb +16 -15
- data/lib/mail/fields/from_field.rb +3 -3
- data/lib/mail/fields/in_reply_to_field.rb +3 -1
- data/lib/mail/fields/keywords_field.rb +2 -2
- data/lib/mail/fields/message_id_field.rb +4 -4
- data/lib/mail/fields/mime_version_field.rb +3 -2
- data/lib/mail/fields/optional_field.rb +1 -0
- data/lib/mail/fields/received_field.rb +4 -3
- data/lib/mail/fields/references_field.rb +3 -1
- 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 +2 -1
- data/lib/mail/fields/resent_from_field.rb +3 -3
- data/lib/mail/fields/resent_message_id_field.rb +1 -0
- data/lib/mail/fields/resent_sender_field.rb +4 -4
- data/lib/mail/fields/resent_to_field.rb +3 -3
- data/lib/mail/fields/return_path_field.rb +1 -1
- data/lib/mail/fields/sender_field.rb +9 -9
- 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 +3 -3
- data/lib/mail/fields/unstructured_field.rb +15 -8
- data/lib/mail/fields.rb +1 -0
- data/lib/mail/header.rb +21 -29
- data/lib/mail/indifferent_hash.rb +1 -0
- data/lib/mail/mail.rb +16 -1
- data/lib/mail/matchers/attachment_matchers.rb +29 -0
- data/lib/mail/matchers/has_sent_mail.rb +61 -4
- data/lib/mail/message.rb +175 -72
- data/lib/mail/multibyte/chars.rb +3 -2
- data/lib/mail/multibyte/exceptions.rb +1 -0
- data/lib/mail/multibyte/unicode.rb +22 -15
- data/lib/mail/multibyte/utils.rb +1 -0
- data/lib/mail/multibyte.rb +1 -0
- data/lib/mail/network/delivery_methods/exim.rb +3 -7
- data/lib/mail/network/delivery_methods/file_delivery.rb +2 -1
- data/lib/mail/network/delivery_methods/sendmail.rb +33 -10
- data/lib/mail/network/delivery_methods/smtp.rb +32 -34
- data/lib/mail/network/delivery_methods/smtp_connection.rb +7 -6
- data/lib/mail/network/delivery_methods/test_mailer.rb +3 -2
- data/lib/mail/network/retriever_methods/base.rb +1 -0
- data/lib/mail/network/retriever_methods/imap.rb +19 -13
- data/lib/mail/network/retriever_methods/pop3.rb +1 -0
- data/lib/mail/network/retriever_methods/test_retriever.rb +1 -0
- data/lib/mail/network.rb +1 -0
- data/lib/mail/parsers/address_lists_parser.rb +133 -0
- data/lib/mail/parsers/content_disposition_parser.rb +68 -0
- data/lib/mail/parsers/content_location_parser.rb +36 -0
- data/lib/mail/parsers/content_transfer_encoding_parser.rb +34 -0
- data/lib/mail/parsers/content_type_parser.rb +67 -0
- data/lib/mail/parsers/date_time_parser.rb +39 -0
- data/lib/mail/parsers/envelope_from_parser.rb +46 -0
- data/lib/mail/parsers/message_ids_parser.rb +40 -0
- data/lib/mail/parsers/mime_version_parser.rb +42 -0
- data/lib/mail/parsers/phrase_lists_parser.rb +36 -0
- data/lib/mail/parsers/ragel/common.rl +185 -0
- data/lib/mail/parsers/ragel/date_time.rl +30 -0
- data/lib/mail/parsers/ragel/parser_info.rb +61 -0
- data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb +14864 -0
- data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb +751 -0
- data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb +614 -0
- data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb +447 -0
- data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb +825 -0
- data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb +817 -0
- data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb +2149 -0
- data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb +1570 -0
- data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb +440 -0
- data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb +564 -0
- data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl +51 -0
- data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb +5144 -0
- data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb.rl +37 -0
- data/lib/mail/parsers/ragel/ruby/parser.rb.rl.erb +37 -0
- data/lib/mail/parsers/ragel/ruby.rb +40 -0
- data/lib/mail/parsers/ragel.rb +18 -0
- data/lib/mail/parsers/received_parser.rb +49 -0
- data/lib/mail/parsers.rb +27 -0
- data/lib/mail/part.rb +11 -4
- data/lib/mail/parts_list.rb +30 -10
- data/lib/mail/utilities.rb +127 -63
- data/lib/mail/values/unicode_tables.dat +0 -0
- data/lib/mail/version.rb +8 -15
- data/lib/mail/version_specific/ruby_1_8.rb +18 -7
- data/lib/mail/version_specific/ruby_1_9.rb +136 -32
- data/lib/mail.rb +12 -6
- metadata +115 -77
- data/lib/VERSION +0 -4
- data/lib/load_parsers.rb +0 -41
- data/lib/mail/core_extensions/nil.rb +0 -19
- data/lib/mail/core_extensions/object.rb +0 -13
- data/lib/mail/core_extensions/shell_escape.rb +0 -56
- data/lib/mail/parsers/address_lists.rb +0 -64
- data/lib/mail/parsers/address_lists.treetop +0 -19
- data/lib/mail/parsers/content_disposition.rb +0 -535
- data/lib/mail/parsers/content_disposition.treetop +0 -46
- data/lib/mail/parsers/content_location.rb +0 -139
- data/lib/mail/parsers/content_location.treetop +0 -20
- data/lib/mail/parsers/content_transfer_encoding.rb +0 -162
- data/lib/mail/parsers/content_transfer_encoding.treetop +0 -20
- data/lib/mail/parsers/content_type.rb +0 -967
- data/lib/mail/parsers/content_type.treetop +0 -68
- data/lib/mail/parsers/date_time.rb +0 -114
- data/lib/mail/parsers/date_time.treetop +0 -11
- data/lib/mail/parsers/envelope_from.rb +0 -194
- data/lib/mail/parsers/envelope_from.treetop +0 -32
- data/lib/mail/parsers/message_ids.rb +0 -45
- data/lib/mail/parsers/message_ids.treetop +0 -15
- data/lib/mail/parsers/mime_version.rb +0 -144
- data/lib/mail/parsers/mime_version.treetop +0 -19
- data/lib/mail/parsers/phrase_lists.rb +0 -45
- data/lib/mail/parsers/phrase_lists.treetop +0 -15
- data/lib/mail/parsers/received.rb +0 -71
- data/lib/mail/parsers/received.treetop +0 -11
- data/lib/mail/parsers/rfc2045.rb +0 -464
- data/lib/mail/parsers/rfc2045.treetop +0 -36
- data/lib/mail/parsers/rfc2822.rb +0 -5397
- data/lib/mail/parsers/rfc2822.treetop +0 -410
- data/lib/mail/parsers/rfc2822_obsolete.rb +0 -3768
- data/lib/mail/parsers/rfc2822_obsolete.treetop +0 -241
- data/lib/tasks/corpus.rake +0 -125
- data/lib/tasks/treetop.rake +0 -10
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
require 'mail/fields/common/parameter_hash'
|
|
3
4
|
|
|
4
5
|
module Mail
|
|
5
6
|
class ContentDispositionField < StructuredField
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
FIELD_NAME = 'content-disposition'
|
|
8
9
|
CAPITALIZED_FIELD = 'Content-Disposition'
|
|
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
|
|
16
17
|
end
|
|
17
|
-
|
|
18
|
+
|
|
18
19
|
def parse(val = value)
|
|
19
|
-
unless
|
|
20
|
+
unless Utilities.blank?(val)
|
|
20
21
|
@element = Mail::ContentDispositionElement.new(val)
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
|
-
|
|
24
|
+
|
|
24
25
|
def element
|
|
25
26
|
@element ||= Mail::ContentDispositionElement.new(value)
|
|
26
27
|
end
|
|
@@ -28,20 +29,20 @@ module Mail
|
|
|
28
29
|
def disposition_type
|
|
29
30
|
element.disposition_type
|
|
30
31
|
end
|
|
31
|
-
|
|
32
|
+
|
|
32
33
|
def parameters
|
|
33
34
|
@parameters = ParameterHash.new
|
|
34
|
-
element.parameters.each { |p| @parameters.merge!(p) }
|
|
35
|
+
element.parameters.each { |p| @parameters.merge!(p) } unless element.parameters.nil?
|
|
35
36
|
@parameters
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
def filename
|
|
39
40
|
case
|
|
40
|
-
when !parameters['filename']
|
|
41
|
+
when !Utilities.blank?(parameters['filename'])
|
|
41
42
|
@filename = parameters['filename']
|
|
42
|
-
when !parameters['name']
|
|
43
|
+
when !Utilities.blank?(parameters['name'])
|
|
43
44
|
@filename = parameters['name']
|
|
44
|
-
else
|
|
45
|
+
else
|
|
45
46
|
@filename = nil
|
|
46
47
|
end
|
|
47
48
|
@filename
|
|
@@ -56,7 +57,7 @@ module Mail
|
|
|
56
57
|
end
|
|
57
58
|
"#{CAPITALIZED_FIELD}: #{disposition_type}" + p
|
|
58
59
|
end
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
def decoded
|
|
61
62
|
if parameters.length > 0
|
|
62
63
|
p = "; #{parameters.decoded}"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
#
|
|
4
5
|
#
|
|
@@ -11,7 +12,7 @@ module Mail
|
|
|
11
12
|
def initialize(value = nil, charset = 'utf-8')
|
|
12
13
|
self.charset = charset
|
|
13
14
|
@uniq = 1
|
|
14
|
-
if
|
|
15
|
+
if Utilities.blank?(value)
|
|
15
16
|
value = generate_content_id
|
|
16
17
|
else
|
|
17
18
|
value = strip_field(FIELD_NAME, value)
|
|
@@ -22,7 +23,7 @@ module Mail
|
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
def parse(val = value)
|
|
25
|
-
unless
|
|
26
|
+
unless Utilities.blank?(val)
|
|
26
27
|
@element = Mail::MessageIdsElement.new(val)
|
|
27
28
|
end
|
|
28
29
|
end
|
|
@@ -55,8 +56,7 @@ module Mail
|
|
|
55
56
|
private
|
|
56
57
|
|
|
57
58
|
def generate_content_id
|
|
58
|
-
|
|
59
|
-
"<#{Mail.random_tag}@#{fqdn}.mail>"
|
|
59
|
+
"<#{Mail.random_tag}@#{::Socket.gethostname}.mail>"
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
#
|
|
4
5
|
#
|
|
@@ -10,25 +11,19 @@ module Mail
|
|
|
10
11
|
|
|
11
12
|
def initialize(value = nil, charset = 'utf-8')
|
|
12
13
|
self.charset = charset
|
|
13
|
-
value = '7bit' if value.to_s =~ /7
|
|
14
|
-
value = '8bit' if value.to_s =~ /8
|
|
14
|
+
value = '7bit' if value.to_s =~ /7-?bits?/i
|
|
15
|
+
value = '8bit' if value.to_s =~ /8-?bits?/i
|
|
15
16
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
16
17
|
self.parse
|
|
17
18
|
self
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def parse(val = value)
|
|
21
|
-
unless
|
|
22
|
+
unless Utilities.blank?(val)
|
|
22
23
|
@element = Mail::ContentTransferEncodingElement.new(val)
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
|
|
26
|
-
def tree
|
|
27
|
-
STDERR.puts("tree is deprecated. Please use encoding to get parse result\n#{caller}")
|
|
28
|
-
@element ||= Mail::ContentTransferEncodingElement.new(value)
|
|
29
|
-
@tree ||= @element.tree
|
|
30
|
-
end
|
|
31
|
-
|
|
32
27
|
def element
|
|
33
28
|
@element ||= Mail::ContentTransferEncodingElement.new(value)
|
|
34
29
|
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
|
|
@@ -19,14 +20,14 @@ 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
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def parse(val = value)
|
|
29
|
-
unless
|
|
30
|
+
unless Utilities.blank?(val)
|
|
30
31
|
self.value = val
|
|
31
32
|
@element = nil
|
|
32
33
|
element
|
|
@@ -180,7 +181,7 @@ module Mail
|
|
|
180
181
|
params = $2.to_s.split(/\s+/)
|
|
181
182
|
params = params.map { |i| i.to_s.chomp.strip }
|
|
182
183
|
params = params.map { |i| i.split(/\s*\=\s*/) }
|
|
183
|
-
params = params.map { |i| "#{i[0]}=#{dquote(i[1].to_s)}" }.join('; ')
|
|
184
|
+
params = params.map { |i| "#{i[0]}=#{dquote(i[1].to_s.gsub(/;$/,""))}" }.join('; ')
|
|
184
185
|
"#{type}; #{params}"
|
|
185
186
|
when val =~ /^\s*$/
|
|
186
187
|
'text/plain'
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
-
#
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
#
|
|
3
4
|
# = Date Field
|
|
4
|
-
#
|
|
5
|
+
#
|
|
5
6
|
# The Date field inherits from StructuredField and handles the Date: header
|
|
6
7
|
# field in the email.
|
|
7
|
-
#
|
|
8
|
+
#
|
|
8
9
|
# Sending date to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a DateField as
|
|
10
|
+
# has a DateField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance methods.
|
|
11
|
-
#
|
|
12
|
+
#
|
|
12
13
|
# There must be excatly one Date field in an RFC2822 email.
|
|
13
|
-
#
|
|
14
|
+
#
|
|
14
15
|
# == Examples:
|
|
15
|
-
#
|
|
16
|
+
#
|
|
16
17
|
# mail = Mail.new
|
|
17
18
|
# mail.date = 'Mon, 24 Nov 1997 14:22:01 -0800'
|
|
18
19
|
# mail.date #=> #<DateTime: 211747170121/86400,-1/3,2299161>
|
|
@@ -20,20 +21,20 @@
|
|
|
20
21
|
# mail[:date] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::DateField:0x180e1c4
|
|
21
22
|
# mail['date'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::DateField:0x180e1c4
|
|
22
23
|
# mail['Date'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::DateField:0x180e1c4
|
|
23
|
-
#
|
|
24
|
+
#
|
|
24
25
|
require 'mail/fields/common/common_date'
|
|
25
26
|
|
|
26
27
|
module Mail
|
|
27
28
|
class DateField < StructuredField
|
|
28
|
-
|
|
29
|
+
|
|
29
30
|
include Mail::CommonDate
|
|
30
|
-
|
|
31
|
+
|
|
31
32
|
FIELD_NAME = 'date'
|
|
32
33
|
CAPITALIZED_FIELD = "Date"
|
|
33
|
-
|
|
34
|
+
|
|
34
35
|
def initialize(value = nil, charset = 'utf-8')
|
|
35
36
|
self.charset = charset
|
|
36
|
-
if
|
|
37
|
+
if Utilities.blank?(value)
|
|
37
38
|
value = ::DateTime.now.strftime('%a, %d %b %Y %H:%M:%S %z')
|
|
38
39
|
else
|
|
39
40
|
value = strip_field(FIELD_NAME, value)
|
|
@@ -44,14 +45,14 @@ module Mail
|
|
|
44
45
|
rescue ArgumentError => e
|
|
45
46
|
raise e unless "invalid date"==e.message
|
|
46
47
|
end
|
|
47
|
-
|
|
48
|
+
|
|
48
49
|
def encoded
|
|
49
50
|
do_encode(CAPITALIZED_FIELD)
|
|
50
51
|
end
|
|
51
|
-
|
|
52
|
+
|
|
52
53
|
def decoded
|
|
53
54
|
do_decode
|
|
54
55
|
end
|
|
55
|
-
|
|
56
|
+
|
|
56
57
|
end
|
|
57
58
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = From Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending from to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a FromField as
|
|
10
|
+
# has a FromField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Only one From field can appear in a header, though it can have multiple
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
#
|
|
17
18
|
# mail = Mail.new
|
|
18
19
|
# mail.from = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
|
19
|
-
# mail.from #=> ['
|
|
20
|
+
# mail.from #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
|
20
21
|
# mail[:from] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4
|
|
21
22
|
# mail['from'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4
|
|
22
23
|
# mail['From'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4
|
|
@@ -39,7 +40,6 @@ module Mail
|
|
|
39
40
|
def initialize(value = nil, charset = 'utf-8')
|
|
40
41
|
self.charset = charset
|
|
41
42
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
42
|
-
self.parse
|
|
43
43
|
self
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = In-Reply-To Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# In-Reply-To: header field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending in_reply_to to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a InReplyToField as
|
|
10
|
+
# has a InReplyToField as its field type. This includes all Mail::CommonMessageId
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Note that, the #message_ids method will return an array of message IDs without the
|
|
@@ -38,6 +39,7 @@ module Mail
|
|
|
38
39
|
|
|
39
40
|
def initialize(value = nil, charset = 'utf-8')
|
|
40
41
|
self.charset = charset
|
|
42
|
+
value = value.join("\r\n\s") if value.is_a?(Array)
|
|
41
43
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
42
44
|
self.parse
|
|
43
45
|
self
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# keywords = "Keywords:" phrase *("," phrase) CRLF
|
|
4
5
|
module Mail
|
|
@@ -10,12 +11,11 @@ module Mail
|
|
|
10
11
|
def initialize(value = nil, charset = 'utf-8')
|
|
11
12
|
self.charset = charset
|
|
12
13
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
13
|
-
self.parse
|
|
14
14
|
self
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def parse(val = value)
|
|
18
|
-
unless
|
|
18
|
+
unless Utilities.blank?(val)
|
|
19
19
|
@phrase_list ||= PhraseList.new(value)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = Message-ID Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# Message-ID: header field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending message_id to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a MessageIdField as
|
|
10
|
+
# has a MessageIdField as its field type. This includes all Mail::CommonMessageId
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Only one MessageId field can appear in a header, and syntactically it can only have
|
|
@@ -41,7 +42,7 @@ module Mail
|
|
|
41
42
|
def initialize(value = nil, charset = 'utf-8')
|
|
42
43
|
self.charset = charset
|
|
43
44
|
@uniq = 1
|
|
44
|
-
if
|
|
45
|
+
if Utilities.blank?(value)
|
|
45
46
|
self.name = CAPITALIZED_FIELD
|
|
46
47
|
self.value = generate_message_id
|
|
47
48
|
else
|
|
@@ -75,8 +76,7 @@ module Mail
|
|
|
75
76
|
private
|
|
76
77
|
|
|
77
78
|
def generate_message_id
|
|
78
|
-
|
|
79
|
-
"<#{Mail.random_tag}@#{fqdn}.mail>"
|
|
79
|
+
"<#{Mail.random_tag}@#{::Socket.gethostname}.mail>"
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
#
|
|
4
5
|
#
|
|
@@ -10,7 +11,7 @@ module Mail
|
|
|
10
11
|
|
|
11
12
|
def initialize(value = nil, charset = 'utf-8')
|
|
12
13
|
self.charset = charset
|
|
13
|
-
if
|
|
14
|
+
if Utilities.blank?(value)
|
|
14
15
|
value = '1.0'
|
|
15
16
|
end
|
|
16
17
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
@@ -20,7 +21,7 @@ module Mail
|
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
def parse(val = value)
|
|
23
|
-
unless
|
|
24
|
+
unless Utilities.blank?(val)
|
|
24
25
|
@element = Mail::MimeVersionElement.new(val)
|
|
25
26
|
end
|
|
26
27
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# trace = [return]
|
|
4
5
|
# 1*received
|
|
@@ -34,7 +35,7 @@ module Mail
|
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def parse(val = value)
|
|
37
|
-
unless
|
|
38
|
+
unless Utilities.blank?(val)
|
|
38
39
|
@element = Mail::ReceivedElement.new(val)
|
|
39
40
|
end
|
|
40
41
|
end
|
|
@@ -56,7 +57,7 @@ module Mail
|
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
def encoded
|
|
59
|
-
if
|
|
60
|
+
if Utilities.blank?(value)
|
|
60
61
|
"#{CAPITALIZED_FIELD}: \r\n"
|
|
61
62
|
else
|
|
62
63
|
"#{CAPITALIZED_FIELD}: #{info}; #{formatted_date}\r\n"
|
|
@@ -64,7 +65,7 @@ module Mail
|
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
def decoded
|
|
67
|
-
if
|
|
68
|
+
if Utilities.blank?(value)
|
|
68
69
|
""
|
|
69
70
|
else
|
|
70
71
|
"#{info}; #{formatted_date}"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = References Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending references to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a ReferencesField as
|
|
10
|
+
# has a ReferencesField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Note that, the #message_ids method will return an array of message IDs without the
|
|
@@ -38,6 +39,7 @@ module Mail
|
|
|
38
39
|
|
|
39
40
|
def initialize(value = nil, charset = 'utf-8')
|
|
40
41
|
self.charset = charset
|
|
42
|
+
value = value.join("\r\n\s") if value.is_a?(Array)
|
|
41
43
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
42
44
|
self.parse
|
|
43
45
|
self
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = Reply-To Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending reply_to to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a ReplyToField as
|
|
10
|
+
# has a ReplyToField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Only one Reply-To field can appear in a header, though it can have multiple
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
#
|
|
17
18
|
# mail = Mail.new
|
|
18
19
|
# mail.reply_to = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
|
19
|
-
# mail.reply_to #=> ['
|
|
20
|
+
# mail.reply_to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
|
20
21
|
# mail[:reply_to] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
|
|
21
22
|
# mail['reply-to'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
|
|
22
23
|
# mail['Reply-To'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
|
|
@@ -39,7 +40,6 @@ module Mail
|
|
|
39
40
|
def initialize(value = nil, charset = 'utf-8')
|
|
40
41
|
self.charset = charset
|
|
41
42
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
42
|
-
self.parse
|
|
43
43
|
self
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = Resent-Bcc Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# Resent-Bcc: header field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending resent_bcc to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a ResentBccField as
|
|
10
|
+
# has a ResentBccField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Only one Resent-Bcc field can appear in a header, though it can have multiple
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
#
|
|
17
18
|
# mail = Mail.new
|
|
18
19
|
# mail.resent_bcc = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
|
19
|
-
# mail.resent_bcc #=> ['
|
|
20
|
+
# mail.resent_bcc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
|
20
21
|
# mail[:resent_bcc] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentBccField:0x180e1c4
|
|
21
22
|
# mail['resent-bcc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentBccField:0x180e1c4
|
|
22
23
|
# mail['Resent-Bcc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentBccField:0x180e1c4
|
|
@@ -39,7 +40,6 @@ module Mail
|
|
|
39
40
|
def initialize(value = nil, charset = 'utf-8')
|
|
40
41
|
self.charset = charset
|
|
41
42
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
42
|
-
self.parse
|
|
43
43
|
self
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = Resent-Cc Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending resent_cc to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a ResentCcField as
|
|
10
|
+
# has a ResentCcField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Only one Resent-Cc field can appear in a header, though it can have multiple
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
#
|
|
17
18
|
# mail = Mail.new
|
|
18
19
|
# mail.resent_cc = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
|
19
|
-
# mail.resent_cc #=> ['
|
|
20
|
+
# mail.resent_cc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
|
20
21
|
# mail[:resent_cc] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentCcField:0x180e1c4
|
|
21
22
|
# mail['resent-cc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentCcField:0x180e1c4
|
|
22
23
|
# mail['Resent-Cc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentCcField:0x180e1c4
|
|
@@ -39,7 +40,6 @@ module Mail
|
|
|
39
40
|
def initialize(value = nil, charset = 'utf-8')
|
|
40
41
|
self.charset = charset
|
|
41
42
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
42
|
-
self.parse
|
|
43
43
|
self
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# resent-date = "Resent-Date:" date-time CRLF
|
|
4
5
|
require 'mail/fields/common/common_date'
|
|
@@ -13,7 +14,7 @@ module Mail
|
|
|
13
14
|
|
|
14
15
|
def initialize(value = nil, charset = 'utf-8')
|
|
15
16
|
self.charset = charset
|
|
16
|
-
if
|
|
17
|
+
if Utilities.blank?(value)
|
|
17
18
|
value = ::DateTime.now.strftime('%a, %d %b %Y %H:%M:%S %z')
|
|
18
19
|
else
|
|
19
20
|
value = strip_field(FIELD_NAME, value)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = Resent-From Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending resent_from to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a ResentFromField as
|
|
10
|
+
# has a ResentFromField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Only one Resent-From field can appear in a header, though it can have multiple
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
#
|
|
17
18
|
# mail = Mail.new
|
|
18
19
|
# mail.resent_from = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
|
19
|
-
# mail.resent_from #=> ['
|
|
20
|
+
# mail.resent_from #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
|
20
21
|
# mail[:resent_from] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentFromField:0x180e1c4
|
|
21
22
|
# mail['resent-from'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentFromField:0x180e1c4
|
|
22
23
|
# mail['Resent-From'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentFromField:0x180e1c4
|
|
@@ -39,7 +40,6 @@ module Mail
|
|
|
39
40
|
def initialize(value = nil, charset = 'utf-8')
|
|
40
41
|
self.charset = charset
|
|
41
42
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
42
|
-
self.parse
|
|
43
43
|
self
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = Resent-Sender Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending resent_sender to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a ResentSenderField as
|
|
10
|
+
# has a ResentSenderField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Only one Resent-Sender field can appear in a header, though it can have multiple
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
#
|
|
17
18
|
# mail = Mail.new
|
|
18
19
|
# mail.resent_sender = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
|
19
|
-
# mail.resent_sender #=> '
|
|
20
|
+
# mail.resent_sender #=> ['mikel@test.lindsaar.net']
|
|
20
21
|
# mail[:resent_sender] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentSenderField:0x180e1c4
|
|
21
22
|
# mail['resent-sender'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentSenderField:0x180e1c4
|
|
22
23
|
# mail['Resent-Sender'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentSenderField:0x180e1c4
|
|
@@ -38,7 +39,6 @@ module Mail
|
|
|
38
39
|
def initialize(value = nil, charset = 'utf-8')
|
|
39
40
|
self.charset = charset
|
|
40
41
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
41
|
-
self.parse
|
|
42
42
|
self
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -47,7 +47,7 @@ module Mail
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def address
|
|
50
|
-
|
|
50
|
+
address_list.addresses.first
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def encoded
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
#
|
|
3
4
|
# = Resent-To Field
|
|
4
5
|
#
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
# field in the email.
|
|
7
8
|
#
|
|
8
9
|
# Sending resent_to to a mail message will instantiate a Mail::Field object that
|
|
9
|
-
# has a ResentToField as
|
|
10
|
+
# has a ResentToField as its field type. This includes all Mail::CommonAddress
|
|
10
11
|
# module instance metods.
|
|
11
12
|
#
|
|
12
13
|
# Only one Resent-To field can appear in a header, though it can have multiple
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
#
|
|
17
18
|
# mail = Mail.new
|
|
18
19
|
# mail.resent_to = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
|
|
19
|
-
# mail.resent_to #=> ['
|
|
20
|
+
# mail.resent_to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
|
20
21
|
# mail[:resent_to] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentToField:0x180e1c4
|
|
21
22
|
# mail['resent-to'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentToField:0x180e1c4
|
|
22
23
|
# mail['Resent-To'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ResentToField:0x180e1c4
|
|
@@ -39,7 +40,6 @@ module Mail
|
|
|
39
40
|
def initialize(value = nil, charset = 'utf-8')
|
|
40
41
|
self.charset = charset
|
|
41
42
|
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
|
|
42
|
-
self.parse
|
|
43
43
|
self
|
|
44
44
|
end
|
|
45
45
|
|