mail 1.5.2 → 1.5.3

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 (33) hide show
  1. data/Rakefile +1 -1
  2. data/lib/mail/fields/bcc_field.rb +2 -0
  3. data/lib/mail/fields/cc_field.rb +2 -0
  4. data/lib/mail/fields/comments_field.rb +3 -0
  5. data/lib/mail/fields/common/common_address.rb +8 -0
  6. data/lib/mail/fields/common/common_date.rb +9 -0
  7. data/lib/mail/fields/common/common_message_id.rb +9 -5
  8. data/lib/mail/fields/content_description_field.rb +3 -0
  9. data/lib/mail/fields/content_disposition_field.rb +7 -3
  10. data/lib/mail/fields/content_id_field.rb +7 -4
  11. data/lib/mail/fields/content_location_field.rb +7 -3
  12. data/lib/mail/fields/content_transfer_encoding_field.rb +9 -2
  13. data/lib/mail/fields/content_type_field.rb +8 -3
  14. data/lib/mail/fields/from_field.rb +3 -0
  15. data/lib/mail/fields/in_reply_to_field.rb +2 -0
  16. data/lib/mail/fields/keywords_field.rb +8 -0
  17. data/lib/mail/fields/message_id_field.rb +3 -1
  18. data/lib/mail/fields/mime_version_field.rb +8 -5
  19. data/lib/mail/fields/received_field.rb +8 -4
  20. data/lib/mail/fields/references_field.rb +3 -0
  21. data/lib/mail/fields/reply_to_field.rb +3 -0
  22. data/lib/mail/fields/resent_bcc_field.rb +3 -0
  23. data/lib/mail/fields/resent_cc_field.rb +3 -0
  24. data/lib/mail/fields/resent_from_field.rb +3 -0
  25. data/lib/mail/fields/resent_message_id_field.rb +3 -0
  26. data/lib/mail/fields/resent_sender_field.rb +3 -0
  27. data/lib/mail/fields/resent_to_field.rb +3 -0
  28. data/lib/mail/fields/return_path_field.rb +3 -0
  29. data/lib/mail/fields/sender_field.rb +3 -0
  30. data/lib/mail/fields/to_field.rb +3 -0
  31. data/lib/mail/fields/unstructured_field.rb +4 -0
  32. data/lib/mail/version.rb +1 -1
  33. metadata +2 -2
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ require 'bundler'
12
12
 
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = "mail"
15
- s.version = "1.5.2"
15
+ s.version = "1.5.3"
16
16
  s.author = "Mike Lindsaar"
17
17
  s.email = "raasdnil@gmail.com"
18
18
  s.homepage = "http://github.com/mikel/mail"
@@ -36,6 +36,8 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
39
41
  end
40
42
 
41
43
  # Bcc field should never be :encoded
@@ -36,6 +36,8 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
39
41
  end
40
42
 
41
43
  def encoded
@@ -32,6 +32,9 @@ module Mail
32
32
 
33
33
  def initialize(*args)
34
34
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
35
+ self.parse
36
+ self
37
+
35
38
  end
36
39
 
37
40
  end
@@ -8,6 +8,14 @@ module Mail
8
8
 
9
9
  module InstanceMethods # :doc:
10
10
 
11
+ def parse(val = value)
12
+ unless val.blank?
13
+ @tree ||= AddressList.new(value)
14
+ else
15
+ nil
16
+ end
17
+ end
18
+
11
19
  # Allows you to iterate through each address object in the syntax tree
12
20
  def each
13
21
  tree.addresses.each do |address|
@@ -12,6 +12,15 @@ module Mail
12
12
  def default
13
13
  date_time
14
14
  end
15
+
16
+ def parse(val = value)
17
+ unless val.blank?
18
+ @element = Mail::DateTimeElement.new(val)
19
+ @tree = @element.tree
20
+ else
21
+ nil
22
+ end
23
+ end
15
24
 
16
25
  private
17
26
 
@@ -7,15 +7,19 @@ module Mail
7
7
  end
8
8
 
9
9
  module InstanceMethods # :doc:
10
-
11
- def tree
12
- @tree ||= element.tree
13
- end
14
-
10
+
15
11
  def element
16
12
  @element ||= Mail::MessageIdsElement.new(value)
17
13
  end
18
14
 
15
+ def parse(val = value)
16
+ unless val.blank?
17
+ @element = Mail::MessageIdsElement.new(val)
18
+ else
19
+ nil
20
+ end
21
+ end
22
+
19
23
  def message_id
20
24
  element.message_id
21
25
  end
@@ -10,6 +10,9 @@ module Mail
10
10
 
11
11
  def initialize(*args)
12
12
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
13
+ self.parse
14
+ self
15
+
13
16
  end
14
17
 
15
18
  end
@@ -10,11 +10,15 @@ module Mail
10
10
 
11
11
  def initialize(*args)
12
12
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
13
+ self.parse
14
+ self
15
+
13
16
  end
14
17
 
15
- def tree
16
- @element ||= Mail::ContentDispositionElement.new(value)
17
- @tree ||= @element.tree
18
+ def parse(val = value)
19
+ unless val.blank?
20
+ @element = Mail::ContentDispositionElement.new(val)
21
+ end
18
22
  end
19
23
 
20
24
  def element
@@ -13,15 +13,18 @@ module Mail
13
13
  if args.last.blank?
14
14
  self.name = CAPITALIZED_FIELD
15
15
  self.value = generate_content_id
16
- self
17
16
  else
18
17
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
19
18
  end
19
+ self.parse
20
+ self
21
+
20
22
  end
21
23
 
22
- def tree
23
- @element ||= Mail::MessageIdsElement.new(value)
24
- @tree ||= @element.tree
24
+ def parse(val = value)
25
+ unless val.blank?
26
+ @element = Mail::MessageIdsElement.new(val)
27
+ end
25
28
  end
26
29
 
27
30
  def element
@@ -10,11 +10,15 @@ module Mail
10
10
 
11
11
  def initialize(*args)
12
12
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
13
+ self.parse
14
+ self
15
+
13
16
  end
14
17
 
15
- def tree
16
- @element ||= Mail::ContentLocationElement.new(value)
17
- @tree ||= @element.tree
18
+ def parse(val = value)
19
+ unless val.blank?
20
+ @element = Mail::ContentLocationElement.new(val)
21
+ end
18
22
  end
19
23
 
20
24
  def element
@@ -12,13 +12,20 @@ module Mail
12
12
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last.to_s.downcase))
13
13
  end
14
14
 
15
+ def parse(val = value)
16
+ unless val.blank?
17
+ @element = Mail::ContentTransferEncodingElement.new(val)
18
+ @tree = @element.tree
19
+ end
20
+ end
21
+
15
22
  def tree
16
- @element ||= ContentTransferEncodingElement.new(value)
23
+ @element ||= Mail::ContentTransferEncodingElement.new(value)
17
24
  @tree ||= @element.tree
18
25
  end
19
26
 
20
27
  def element
21
- @element ||= ContentTransferEncodingElement.new(value)
28
+ @element ||= Mail::ContentTransferEncodingElement.new(value)
22
29
  end
23
30
 
24
31
  def encoding
@@ -20,11 +20,16 @@ module Mail
20
20
  @parameters = nil
21
21
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
22
22
  end
23
+ self.parse
24
+ self
23
25
  end
24
26
 
25
- def tree
26
- @element ||= Mail::ContentTypeElement.new(value)
27
- @tree ||= @element.tree
27
+ def parse(val = value)
28
+ unless val.blank?
29
+ self.value = val
30
+ @element = nil
31
+ element
32
+ end
28
33
  end
29
34
 
30
35
  def element
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def encoded
@@ -36,6 +36,8 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
39
41
  end
40
42
 
41
43
  def encoded
@@ -9,6 +9,14 @@ module Mail
9
9
 
10
10
  def initialize(*args)
11
11
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
12
+ self.parse
13
+ self
14
+ end
15
+
16
+ def parse(val = value)
17
+ unless val.blank?
18
+ @phrase_list ||= PhraseList.new(value)
19
+ end
12
20
  end
13
21
 
14
22
  def phrase_list
@@ -41,10 +41,12 @@ module Mail
41
41
  if args.last.blank?
42
42
  self.name = CAPITALIZED_FIELD
43
43
  self.value = generate_message_id
44
- self
45
44
  else
46
45
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
47
46
  end
47
+ self.parse
48
+ self
49
+
48
50
  end
49
51
 
50
52
  def name
@@ -12,19 +12,22 @@ module Mail
12
12
  if args.last.blank?
13
13
  self.name = CAPITALIZED_FIELD
14
14
  self.value = '1.0'
15
- self
16
15
  else
17
16
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
18
17
  end
18
+ self.parse
19
+ self
20
+
19
21
  end
20
22
 
21
- def tree
22
- @element ||= MimeVersionElement.new(value)
23
- @tree ||= @element.tree
23
+ def parse(val = value)
24
+ unless val.blank?
25
+ @element = Mail::MimeVersionElement.new(val)
26
+ end
24
27
  end
25
28
 
26
29
  def element
27
- @element ||= MimeVersionElement.new(value)
30
+ @element ||= Mail::MimeVersionElement.new(value)
28
31
  end
29
32
 
30
33
  def version
@@ -27,15 +27,19 @@ module Mail
27
27
 
28
28
  def initialize(*args)
29
29
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
30
+ self.parse
31
+ self
32
+
30
33
  end
31
34
 
32
- def tree
33
- @element ||= ReceivedElement.new(value)
34
- @tree ||= @element.tree
35
+ def parse(val = value)
36
+ unless val.blank?
37
+ @element = Mail::ReceivedElement.new(val)
38
+ end
35
39
  end
36
40
 
37
41
  def element
38
- @element ||= ReceivedElement.new(value)
42
+ @element ||= Mail::ReceivedElement.new(value)
39
43
  end
40
44
 
41
45
  def date_time
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def encoded
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def encoded
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def encoded
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def encoded
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def encoded
@@ -11,6 +11,9 @@ module Mail
11
11
 
12
12
  def initialize(*args)
13
13
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
14
+ self.parse
15
+ self
16
+
14
17
  end
15
18
 
16
19
  def name
@@ -35,6 +35,9 @@ module Mail
35
35
 
36
36
  def initialize(*args)
37
37
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
38
+ self.parse
39
+ self
40
+
38
41
  end
39
42
 
40
43
  def addresses
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def encoded
@@ -37,6 +37,9 @@ module Mail
37
37
 
38
38
  def initialize(*args)
39
39
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
40
+ self.parse
41
+ self
42
+
40
43
  end
41
44
 
42
45
  def encoded
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def addresses
@@ -36,6 +36,9 @@ module Mail
36
36
 
37
37
  def initialize(*args)
38
38
  super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last))
39
+ self.parse
40
+ self
41
+
39
42
  end
40
43
 
41
44
  def encoded
@@ -34,6 +34,10 @@ module Mail
34
34
  def default
35
35
  decoded
36
36
  end
37
+
38
+ def parse # An unstructured field does not parse
39
+ self
40
+ end
37
41
 
38
42
  private
39
43
 
data/lib/mail/version.rb CHANGED
@@ -3,7 +3,7 @@ module Mail
3
3
  module VERSION
4
4
  MAJOR = 1
5
5
  MINOR = 5
6
- TINY = 2
6
+ TINY = 3
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  end
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.5.2
4
+ version: 1.5.3
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: 2010-01-08 00:00:00 +11:00
12
+ date: 2010-01-12 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency