mail 2.5.3 → 2.5.4

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.

Files changed (66) hide show
  1. data/CHANGELOG.rdoc +65 -0
  2. data/CONTRIBUTING.md +4 -4
  3. data/Gemfile +7 -20
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +10 -9
  6. data/Rakefile +3 -20
  7. data/lib/VERSION +1 -1
  8. data/lib/mail.rb +0 -1
  9. data/lib/mail/attachments_list.rb +2 -2
  10. data/lib/mail/body.rb +4 -4
  11. data/lib/mail/check_delivery_params.rb +12 -22
  12. data/lib/mail/core_extensions/object.rb +8 -8
  13. data/lib/mail/core_extensions/smtp.rb +12 -13
  14. data/lib/mail/core_extensions/string.rb +4 -4
  15. data/lib/mail/elements/address.rb +13 -5
  16. data/lib/mail/elements/envelope_from_element.rb +15 -2
  17. data/lib/mail/encodings.rb +61 -28
  18. data/lib/mail/encodings/quoted_printable.rb +4 -3
  19. data/lib/mail/field.rb +10 -11
  20. data/lib/mail/fields/bcc_field.rb +2 -2
  21. data/lib/mail/fields/cc_field.rb +2 -2
  22. data/lib/mail/fields/comments_field.rb +1 -1
  23. data/lib/mail/fields/common/common_address.rb +13 -3
  24. data/lib/mail/fields/common/common_field.rb +4 -4
  25. data/lib/mail/fields/content_id_field.rb +1 -2
  26. data/lib/mail/fields/content_transfer_encoding_field.rb +2 -2
  27. data/lib/mail/fields/content_type_field.rb +1 -1
  28. data/lib/mail/fields/date_field.rb +1 -1
  29. data/lib/mail/fields/from_field.rb +2 -2
  30. data/lib/mail/fields/in_reply_to_field.rb +2 -1
  31. data/lib/mail/fields/message_id_field.rb +2 -3
  32. data/lib/mail/fields/references_field.rb +2 -1
  33. data/lib/mail/fields/reply_to_field.rb +2 -2
  34. data/lib/mail/fields/resent_bcc_field.rb +2 -2
  35. data/lib/mail/fields/resent_cc_field.rb +2 -2
  36. data/lib/mail/fields/resent_from_field.rb +2 -2
  37. data/lib/mail/fields/resent_sender_field.rb +2 -2
  38. data/lib/mail/fields/resent_to_field.rb +2 -2
  39. data/lib/mail/fields/sender_field.rb +7 -7
  40. data/lib/mail/fields/to_field.rb +2 -2
  41. data/lib/mail/fields/unstructured_field.rb +1 -1
  42. data/lib/mail/header.rb +5 -1
  43. data/lib/mail/message.rb +133 -37
  44. data/lib/mail/multibyte/chars.rb +2 -2
  45. data/lib/mail/multibyte/unicode.rb +5 -3
  46. data/lib/mail/network/delivery_methods/exim.rb +1 -6
  47. data/lib/mail/network/delivery_methods/file_delivery.rb +1 -1
  48. data/lib/mail/network/delivery_methods/sendmail.rb +32 -10
  49. data/lib/mail/network/delivery_methods/smtp.rb +35 -34
  50. data/lib/mail/network/delivery_methods/smtp_connection.rb +6 -6
  51. data/lib/mail/network/delivery_methods/test_mailer.rb +2 -2
  52. data/lib/mail/parsers/content_transfer_encoding.rb +81 -42
  53. data/lib/mail/parsers/content_transfer_encoding.treetop +4 -6
  54. data/lib/mail/parsers/content_type.rb +16 -12
  55. data/lib/mail/parsers/content_type.treetop +2 -2
  56. data/lib/mail/parsers/rfc2045.rb +12 -55
  57. data/lib/mail/parsers/rfc2045.treetop +1 -2
  58. data/lib/mail/parsers/rfc2822.rb +50 -50
  59. data/lib/mail/parsers/rfc2822.treetop +19 -21
  60. data/lib/mail/part.rb +6 -2
  61. data/lib/mail/patterns.rb +1 -0
  62. data/lib/mail/utilities.rb +25 -17
  63. data/lib/mail/version_specific/ruby_1_8.rb +5 -1
  64. data/lib/mail/version_specific/ruby_1_9.rb +46 -21
  65. metadata +57 -8
  66. data/lib/mail/core_extensions/shell_escape.rb +0 -56
@@ -26,8 +26,21 @@ module Mail
26
26
  @address
27
27
  end
28
28
 
29
- def to_s(*args)
30
- "#{@info}; #{@date_time.to_s(*args)}"
29
+ # RFC 4155:
30
+ # a timestamp indicating the UTC date and time when the message
31
+ # was originally received, conformant with the syntax of the
32
+ # traditional UNIX 'ctime' output sans timezone (note that the
33
+ # use of UTC precludes the need for a timezone indicator);
34
+ def formatted_date_time
35
+ if @date_time.respond_to?(:ctime)
36
+ @date_time.ctime
37
+ else
38
+ @date_time.strftime '%a %b %e %T %Y'
39
+ end
40
+ end
41
+
42
+ def to_s
43
+ "#{@address} #{formatted_date_time}"
31
44
  end
32
45
 
33
46
  end
@@ -53,7 +53,7 @@ module Mail
53
53
  # Encodes a parameter value using URI Escaping, note the language field 'en' can
54
54
  # be set using Mail::Configuration, like so:
55
55
  #
56
- # Mail.defaults.do
56
+ # Mail.defaults do
57
57
  # param_encode_language 'jp'
58
58
  # end
59
59
  #
@@ -114,41 +114,40 @@ module Mail
114
114
  # String has to be of the format =?<encoding>?[QB]?<string>?=
115
115
  def Encodings.value_decode(str)
116
116
  # Optimization: If there's no encoded-words in the string, just return it
117
- return str unless str.index("=?")
117
+ return str unless str =~ /\=\?[^?]+\?[QB]\?[^?]+?\?\=/xmi
118
118
 
119
- str = str.gsub(/\?=(\s*)=\?/, '?==?') # Remove whitespaces between 'encoded-word's
119
+ lines = collapse_adjacent_encodings(str)
120
120
 
121
121
  # Split on white-space boundaries with capture, so we capture the white-space as well
122
- str.split(/([ \t])/).map do |text|
123
- if text.index('=?') .nil?
124
- text
125
- else
126
- # Join QP encoded-words that are adjacent to avoid decoding partial chars
127
- text.gsub!(/\?\=\=\?.+?\?[Qq]\?/m, '') if text =~ /\?==\?/
128
-
129
- # Search for occurences of quoted strings or plain strings
130
- text.scan(/( # Group around entire regex to include it in matches
131
- \=\?[^?]+\?([QB])\?[^?]+?\?\= # Quoted String with subgroup for encoding method
132
- | # or
133
- .+?(?=\=\?|$) # Plain String
134
- )/xmi).map do |matches|
135
- string, method = *matches
136
- if method == 'b' || method == 'B'
137
- b_value_decode(string)
138
- elsif method == 'q' || method == 'Q'
139
- q_value_decode(string)
140
- else
141
- string
122
+ lines.map do |line|
123
+ line.split(/([ \t])/).map do |text|
124
+ if text.index('=?').nil?
125
+ text
126
+ else
127
+ # Search for occurences of quoted strings or plain strings
128
+ text.scan(/( # Group around entire regex to include it in matches
129
+ \=\?[^?]+\?([QB])\?[^?]+?\?\= # Quoted String with subgroup for encoding method
130
+ | # or
131
+ .+?(?=\=\?|$) # Plain String
132
+ )/xmi).map do |matches|
133
+ string, method = *matches
134
+ if method == 'b' || method == 'B'
135
+ b_value_decode(string)
136
+ elsif method == 'q' || method == 'Q'
137
+ q_value_decode(string)
138
+ else
139
+ string
140
+ end
142
141
  end
143
142
  end
144
143
  end
145
- end.join("")
144
+ end.flatten.join("")
146
145
  end
147
146
 
148
147
  # Takes an encoded string of the format =?<encoding>?[QB]?<string>?=
149
148
  def Encodings.unquote_and_convert_to(str, to_encoding)
150
149
  output = value_decode( str ).to_s # output is already converted to UTF-8
151
-
150
+
152
151
  if 'utf8' == to_encoding.to_s.downcase.gsub("-", "")
153
152
  output
154
153
  elsif to_encoding
@@ -157,7 +156,7 @@ module Mail
157
156
  output.encode(to_encoding)
158
157
  else
159
158
  require 'iconv'
160
- Iconv.iconv(to_encoding, 'UTF-8', output).first
159
+ Iconv.iconv(to_encoding, 'UTF-8', output).first
161
160
  end
162
161
  rescue Iconv::IllegalSequence, Iconv::InvalidEncoding, Errno::EINVAL
163
162
  # the 'from' parameter specifies a charset other than what the text
@@ -194,8 +193,8 @@ module Mail
194
193
  if word.ascii_only?
195
194
  word
196
195
  else
197
- previous_non_ascii = tokens[i-1] && !tokens[i-1].ascii_only?
198
- if previous_non_ascii
196
+ previous_non_ascii = i>0 && tokens[i-1] && !tokens[i-1].ascii_only?
197
+ if previous_non_ascii #why are we adding an extra space here?
199
198
  word = " #{word}"
200
199
  end
201
200
  Encodings.b_value_encode(word, charset)
@@ -268,5 +267,39 @@ module Mail
268
267
  def Encodings.find_encoding(str)
269
268
  RUBY_VERSION >= '1.9' ? str.encoding : $KCODE
270
269
  end
270
+
271
+ # Gets the encoding type (Q or B) from the string.
272
+ def Encodings.split_value_encoding_from_string(str)
273
+ match = str.match(/\=\?[^?]+?\?([QB])\?(.+)?\?\=/mi)
274
+ if match
275
+ match[1]
276
+ else
277
+ nil
278
+ end
279
+ end
280
+
281
+ # When the encoded string consists of multiple lines, lines with the same
282
+ # encoding (Q or B) can be joined together.
283
+ #
284
+ # String has to be of the format =?<encoding>?[QB]?<string>?=
285
+ def Encodings.collapse_adjacent_encodings(str)
286
+ lines = str.split(/(\?=)\s*(=\?)/).each_slice(2).map(&:join)
287
+ results = []
288
+ previous_encoding = nil
289
+
290
+ lines.each do |line|
291
+ encoding = split_value_encoding_from_string(line)
292
+
293
+ if encoding == previous_encoding
294
+ line = results.pop + line
295
+ line.gsub!(/\?\=\=\?.+?\?[QqBb]\?/m, '')
296
+ end
297
+
298
+ previous_encoding = encoding
299
+ results << line
300
+ end
301
+
302
+ results
303
+ end
271
304
  end
272
305
  end
@@ -12,13 +12,14 @@ module Mail
12
12
  EightBit.can_encode? str
13
13
  end
14
14
 
15
- # Decode the string from Quoted-Printable
15
+ # Decode the string from Quoted-Printable. Cope with hard line breaks
16
+ # that were incorrectly encoded as hex instead of literal CRLF.
16
17
  def self.decode(str)
17
- str.unpack("M*").first
18
+ str.gsub(/(?:=0D=0A|=0D|=0A)\r\n/, "\r\n").unpack("M*").first.to_lf
18
19
  end
19
20
 
20
21
  def self.encode(str)
21
- [str].pack("M").to_crlf
22
+ [str.to_lf].pack("M").to_crlf
22
23
  end
23
24
 
24
25
  def self.cost(str)
@@ -156,9 +156,11 @@ module Mail
156
156
  alias_method :==, :same
157
157
 
158
158
  def <=>( other )
159
- self_order = FIELD_ORDER.rindex(self.name.to_s.downcase) || 100
160
- other_order = FIELD_ORDER.rindex(other.name.to_s.downcase) || 100
161
- self_order <=> other_order
159
+ self.field_order_id <=> other.field_order_id
160
+ end
161
+
162
+ def field_order_id
163
+ @field_order_id ||= (FIELD_ORDER_LOOKUP[self.name.to_s.downcase] || 100)
162
164
  end
163
165
 
164
166
  def method_missing(name, *args, &block)
@@ -174,10 +176,12 @@ module Mail
174
176
  mime-version content-type content-transfer-encoding
175
177
  content-location content-disposition content-description ]
176
178
 
179
+ FIELD_ORDER_LOOKUP = Hash[FIELD_ORDER.each_with_index.to_a]
180
+
177
181
  private
178
182
 
179
183
  def split(raw_field)
180
- match_data = raw_field.mb_chars.match(/^(#{FIELD_NAME})\s*:\s*(#{FIELD_BODY})?$/)
184
+ match_data = raw_field.mb_chars.match(FIELD_SPLIT)
181
185
  [match_data[1].to_s.mb_chars.strip, match_data[2].to_s.mb_chars.strip]
182
186
  rescue
183
187
  STDERR.puts "WARNING: Could not parse (and so ignoring) '#{raw_field}'"
@@ -195,16 +199,11 @@ module Mail
195
199
 
196
200
  def new_field(name, value, charset)
197
201
  lower_case_name = name.to_s.downcase
198
- header_name = nil
199
- FIELDS_MAP.each do |field_name, _|
200
- header_name = field_name if lower_case_name == field_name
201
- end
202
- if header_name
203
- FIELDS_MAP[header_name].new(value, charset)
202
+ if field_klass = FIELDS_MAP[lower_case_name]
203
+ field_klass.new(value, charset)
204
204
  else
205
205
  OptionalField.new(name, value, charset)
206
206
  end
207
-
208
207
  end
209
208
 
210
209
  end
@@ -6,7 +6,7 @@
6
6
  # field in the email.
7
7
  #
8
8
  # Sending bcc to a mail message will instantiate a Mail::Field object that
9
- # has a BccField as it's field type. This includes all Mail::CommonAddress
9
+ # has a BccField as its field type. This includes all Mail::CommonAddress
10
10
  # module instance metods.
11
11
  #
12
12
  # Only one Bcc field can appear in a header, though it can have multiple
@@ -16,7 +16,7 @@
16
16
  #
17
17
  # mail = Mail.new
18
18
  # mail.bcc = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
19
- # mail.bcc #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
19
+ # mail.bcc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
20
20
  # mail[:bcc] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::BccField:0x180e1c4
21
21
  # mail['bcc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::BccField:0x180e1c4
22
22
  # mail['Bcc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::BccField:0x180e1c4
@@ -6,7 +6,7 @@
6
6
  # field in the email.
7
7
  #
8
8
  # Sending cc to a mail message will instantiate a Mail::Field object that
9
- # has a CcField as it's field type. This includes all Mail::CommonAddress
9
+ # has a CcField as its field type. This includes all Mail::CommonAddress
10
10
  # module instance metods.
11
11
  #
12
12
  # Only one Cc field can appear in a header, though it can have multiple
@@ -16,7 +16,7 @@
16
16
  #
17
17
  # mail = Mail.new
18
18
  # mail.cc = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
19
- # mail.cc #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
19
+ # mail.cc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
20
20
  # mail[:cc] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::CcField:0x180e1c4
21
21
  # mail['cc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::CcField:0x180e1c4
22
22
  # mail['Cc'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::CcField:0x180e1c4
@@ -6,7 +6,7 @@
6
6
  # header field in the email.
7
7
  #
8
8
  # Sending comments to a mail message will instantiate a Mail::Field object that
9
- # has a CommentsField as it's field type.
9
+ # has a CommentsField as its field type.
10
10
  #
11
11
  # An email header can have as many comments fields as it wants. There is no upper
12
12
  # limit, the comments field is also optional (that is, no comment is needed)
@@ -62,7 +62,17 @@ module Mail
62
62
 
63
63
  # Returns the addresses that are part of groups
64
64
  def group_addresses
65
- groups.map { |k,v| v.map { |a| a.format } }.flatten
65
+ decoded_group_addresses
66
+ end
67
+
68
+ # Returns a list of decoded group addresses
69
+ def decoded_group_addresses
70
+ groups.map { |k,v| v.map { |a| a.decoded } }.flatten
71
+ end
72
+
73
+ # Returns a list of encoded group addresses
74
+ def encoded_group_addresses
75
+ groups.map { |k,v| v.map { |a| a.encoded } }.flatten
66
76
  end
67
77
 
68
78
  # Returns the name of all the groups in a string
@@ -94,7 +104,7 @@ module Mail
94
104
 
95
105
  def do_encode(field_name)
96
106
  return '' if value.blank?
97
- address_array = tree.addresses.reject { |a| group_addresses.include?(a.encoded) }.compact.map { |a| a.encoded }
107
+ address_array = tree.addresses.reject { |a| encoded_group_addresses.include?(a.encoded) }.compact.map { |a| a.encoded }
98
108
  address_text = address_array.join(", \r\n\s")
99
109
  group_array = groups.map { |k,v| "#{k}: #{v.map { |a| a.encoded }.join(", \r\n\s")};" }
100
110
  group_text = group_array.join(" \r\n\s")
@@ -104,7 +114,7 @@ module Mail
104
114
 
105
115
  def do_decode
106
116
  return nil if value.blank?
107
- address_array = tree.addresses.reject { |a| group_addresses.include?(a.decoded) }.map { |a| a.decoded }
117
+ address_array = tree.addresses.reject { |a| decoded_group_addresses.include?(a.decoded) }.map { |a| a.decoded }
108
118
  address_text = address_array.join(", ")
109
119
  group_array = groups.map { |k,v| "#{k}: #{v.map { |a| a.decoded }.join(", ")};" }
110
120
  group_text = group_array.join(" ")
@@ -22,7 +22,7 @@ module Mail
22
22
  end
23
23
 
24
24
  def to_s
25
- decoded
25
+ decoded.to_s
26
26
  end
27
27
 
28
28
  def default
@@ -47,11 +47,11 @@ module Mail
47
47
  end
48
48
  end
49
49
 
50
+ FILENAME_RE = /\b(filename|name)=([^;"\r\n]+\s[^;"\r\n]+)/
50
51
  def ensure_filename_quoted(value)
51
- if !value.is_a?(Array) and /(.)*\s(filename|name)=[^"](.+\s)+[^"]/.match value
52
- value.gsub!(/[^=]+$/, '"\\0"')
52
+ if value.is_a?(String)
53
+ value.sub! FILENAME_RE, '\1="\2"'
53
54
  end
54
55
  end
55
-
56
56
  end
57
57
  end
@@ -55,8 +55,7 @@ module Mail
55
55
  private
56
56
 
57
57
  def generate_content_id
58
- fqdn = ::Socket.gethostname
59
- "<#{Mail.random_tag}@#{fqdn}.mail>"
58
+ "<#{Mail.random_tag}@#{::Socket.gethostname}.mail>"
60
59
  end
61
60
 
62
61
  end
@@ -10,8 +10,8 @@ module Mail
10
10
 
11
11
  def initialize(value = nil, charset = 'utf-8')
12
12
  self.charset = charset
13
- value = '7bit' if value.to_s =~ /7-bit/i
14
- value = '8bit' if value.to_s =~ /8-bit/i
13
+ value = '7bit' if value.to_s =~ /7-?bits?/i
14
+ value = '8bit' if value.to_s =~ /8-?bits?/i
15
15
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
16
16
  self.parse
17
17
  self
@@ -180,7 +180,7 @@ module Mail
180
180
  params = $2.to_s.split(/\s+/)
181
181
  params = params.map { |i| i.to_s.chomp.strip }
182
182
  params = params.map { |i| i.split(/\s*\=\s*/) }
183
- params = params.map { |i| "#{i[0]}=#{dquote(i[1].to_s)}" }.join('; ')
183
+ params = params.map { |i| "#{i[0]}=#{dquote(i[1].to_s.gsub(/;$/,""))}" }.join('; ')
184
184
  "#{type}; #{params}"
185
185
  when val =~ /^\s*$/
186
186
  'text/plain'
@@ -6,7 +6,7 @@
6
6
  # field in the email.
7
7
  #
8
8
  # Sending date to a mail message will instantiate a Mail::Field object that
9
- # has a DateField as it's field type. This includes all Mail::CommonAddress
9
+ # has a DateField as its field type. This includes all Mail::CommonAddress
10
10
  # module instance methods.
11
11
  #
12
12
  # There must be excatly one Date field in an RFC2822 email.
@@ -6,7 +6,7 @@
6
6
  # field in the email.
7
7
  #
8
8
  # Sending from to a mail message will instantiate a Mail::Field object that
9
- # has a FromField as it's field type. This includes all Mail::CommonAddress
9
+ # has a FromField as its field type. This includes all Mail::CommonAddress
10
10
  # module instance metods.
11
11
  #
12
12
  # Only one From field can appear in a header, though it can have multiple
@@ -16,7 +16,7 @@
16
16
  #
17
17
  # mail = Mail.new
18
18
  # mail.from = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
19
- # mail.from #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
19
+ # mail.from #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
20
20
  # mail[:from] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4
21
21
  # mail['from'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4
22
22
  # mail['From'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4
@@ -6,7 +6,7 @@
6
6
  # In-Reply-To: header field in the email.
7
7
  #
8
8
  # Sending in_reply_to to a mail message will instantiate a Mail::Field object that
9
- # has a InReplyToField as it's field type. This includes all Mail::CommonMessageId
9
+ # has a InReplyToField as its field type. This includes all Mail::CommonMessageId
10
10
  # module instance metods.
11
11
  #
12
12
  # Note that, the #message_ids method will return an array of message IDs without the
@@ -38,6 +38,7 @@ module Mail
38
38
 
39
39
  def initialize(value = nil, charset = 'utf-8')
40
40
  self.charset = charset
41
+ value = value.join("\r\n\s") if value.is_a?(Array)
41
42
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
42
43
  self.parse
43
44
  self
@@ -6,7 +6,7 @@
6
6
  # Message-ID: header field in the email.
7
7
  #
8
8
  # Sending message_id to a mail message will instantiate a Mail::Field object that
9
- # has a MessageIdField as it's field type. This includes all Mail::CommonMessageId
9
+ # has a MessageIdField as its field type. This includes all Mail::CommonMessageId
10
10
  # module instance metods.
11
11
  #
12
12
  # Only one MessageId field can appear in a header, and syntactically it can only have
@@ -75,8 +75,7 @@ module Mail
75
75
  private
76
76
 
77
77
  def generate_message_id
78
- fqdn = ::Socket.gethostname
79
- "<#{Mail.random_tag}@#{fqdn}.mail>"
78
+ "<#{Mail.random_tag}@#{::Socket.gethostname}.mail>"
80
79
  end
81
80
 
82
81
  end
@@ -6,7 +6,7 @@
6
6
  # field in the email.
7
7
  #
8
8
  # Sending references to a mail message will instantiate a Mail::Field object that
9
- # has a ReferencesField as it's field type. This includes all Mail::CommonAddress
9
+ # has a ReferencesField as its field type. This includes all Mail::CommonAddress
10
10
  # module instance metods.
11
11
  #
12
12
  # Note that, the #message_ids method will return an array of message IDs without the
@@ -38,6 +38,7 @@ module Mail
38
38
 
39
39
  def initialize(value = nil, charset = 'utf-8')
40
40
  self.charset = charset
41
+ value = value.join("\r\n\s") if value.is_a?(Array)
41
42
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
42
43
  self.parse
43
44
  self
@@ -6,7 +6,7 @@
6
6
  # field in the email.
7
7
  #
8
8
  # Sending reply_to to a mail message will instantiate a Mail::Field object that
9
- # has a ReplyToField as it's field type. This includes all Mail::CommonAddress
9
+ # has a ReplyToField as its field type. This includes all Mail::CommonAddress
10
10
  # module instance metods.
11
11
  #
12
12
  # Only one Reply-To field can appear in a header, though it can have multiple
@@ -16,7 +16,7 @@
16
16
  #
17
17
  # mail = Mail.new
18
18
  # mail.reply_to = 'Mikel Lindsaar <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
19
- # mail.reply_to #=> ['Mikel Lindsaar <mikel@test.lindsaar.net>', 'ada@test.lindsaar.net']
19
+ # mail.reply_to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
20
20
  # mail[:reply_to] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
21
21
  # mail['reply-to'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4
22
22
  # mail['Reply-To'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ReplyToField:0x180e1c4