mail 1.5.4 → 1.6.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/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.4"
15
+ s.version = "1.6.0"
16
16
  s.author = "Mike Lindsaar"
17
17
  s.email = "raasdnil@gmail.com"
18
18
  s.homepage = "http://github.com/mikel/mail"
@@ -53,11 +53,7 @@ module Mail
53
53
  end
54
54
 
55
55
  def default
56
- if addresses.length == 1
57
- addresses[0]
58
- else
59
- addresses
60
- end
56
+ addresses
61
57
  end
62
58
 
63
59
  private
@@ -57,5 +57,9 @@ module Mail
57
57
  do_decode
58
58
  end
59
59
 
60
+ def default
61
+ address.address
62
+ end
63
+
60
64
  end
61
65
  end
@@ -255,14 +255,13 @@ module Mail
255
255
  end
256
256
  end
257
257
 
258
- # Returns the Bcc value of the mail object, either a single string of an address
259
- # spec or an array of strings of address specs if there is more than one address
260
- # in the Bcc.
258
+ # Returns the Bcc value of the mail object as an array of strings of
259
+ # address specs.
261
260
  #
262
261
  # Example:
263
262
  #
264
263
  # mail.bcc = 'Mikel <mikel@test.lindsaar.net>'
265
- # mail.bcc #=> 'mikel@test.lindsaar.net'
264
+ # mail.bcc #=> ['mikel@test.lindsaar.net']
266
265
  # mail.bcc = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
267
266
  # mail.bcc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
268
267
  #
@@ -271,7 +270,7 @@ module Mail
271
270
  # Example:
272
271
  #
273
272
  # mail.bcc 'Mikel <mikel@test.lindsaar.net>'
274
- # mail.bcc #=> 'mikel@test.lindsaar.net'
273
+ # mail.bcc #=> ['mikel@test.lindsaar.net']
275
274
  def bcc( val = nil )
276
275
  default :bcc, val
277
276
  end
@@ -281,21 +280,20 @@ module Mail
281
280
  # Example:
282
281
  #
283
282
  # mail.bcc = 'Mikel <mikel@test.lindsaar.net>'
284
- # mail.bcc #=> 'mikel@test.lindsaar.net'
283
+ # mail.bcc #=> ['mikel@test.lindsaar.net']
285
284
  # mail.bcc = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
286
285
  # mail.bcc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
287
286
  def bcc=( val )
288
287
  header[:bcc] = val
289
288
  end
290
289
 
291
- # Returns the Cc value of the mail object, either a single string of an address
292
- # spec or an array of strings of address specs if there is more than one address
293
- # in the Cc.
290
+ # Returns the Cc value of the mail object as an array of strings of
291
+ # address specs.
294
292
  #
295
293
  # Example:
296
294
  #
297
295
  # mail.cc = 'Mikel <mikel@test.lindsaar.net>'
298
- # mail.cc #=> 'mikel@test.lindsaar.net'
296
+ # mail.cc #=> ['mikel@test.lindsaar.net']
299
297
  # mail.cc = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
300
298
  # mail.cc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
301
299
  #
@@ -304,7 +302,7 @@ module Mail
304
302
  # Example:
305
303
  #
306
304
  # mail.cc 'Mikel <mikel@test.lindsaar.net>'
307
- # mail.cc #=> 'mikel@test.lindsaar.net'
305
+ # mail.cc #=> ['mikel@test.lindsaar.net']
308
306
  def cc( val = nil )
309
307
  default :cc, val
310
308
  end
@@ -314,7 +312,7 @@ module Mail
314
312
  # Example:
315
313
  #
316
314
  # mail.cc = 'Mikel <mikel@test.lindsaar.net>'
317
- # mail.cc #=> 'mikel@test.lindsaar.net'
315
+ # mail.cc #=> ['mikel@test.lindsaar.net']
318
316
  # mail.cc = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
319
317
  # mail.cc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
320
318
  def cc=( val )
@@ -385,14 +383,13 @@ module Mail
385
383
  header[:date] = val
386
384
  end
387
385
 
388
- # Returns the From value of the mail object, either a single string of an address
389
- # spec or an array of strings of address specs if there is more than one address
390
- # in the From.
386
+ # Returns the From value of the mail object as an array of strings of
387
+ # address specs.
391
388
  #
392
389
  # Example:
393
390
  #
394
391
  # mail.from = 'Mikel <mikel@test.lindsaar.net>'
395
- # mail.from #=> 'mikel@test.lindsaar.net'
392
+ # mail.from #=> ['mikel@test.lindsaar.net']
396
393
  # mail.from = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
397
394
  # mail.from #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
398
395
  #
@@ -401,7 +398,7 @@ module Mail
401
398
  # Example:
402
399
  #
403
400
  # mail.from 'Mikel <mikel@test.lindsaar.net>'
404
- # mail.from #=> 'mikel@test.lindsaar.net'
401
+ # mail.from #=> ['mikel@test.lindsaar.net']
405
402
  def from( val = nil )
406
403
  default :from, val
407
404
  end
@@ -411,7 +408,7 @@ module Mail
411
408
  # Example:
412
409
  #
413
410
  # mail.from = 'Mikel <mikel@test.lindsaar.net>'
414
- # mail.from #=> 'mikel@test.lindsaar.net'
411
+ # mail.from #=> ['mikel@test.lindsaar.net']
415
412
  # mail.from = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
416
413
  # mail.from #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
417
414
  def from=( val )
@@ -507,14 +504,13 @@ module Mail
507
504
  header[:references] = val
508
505
  end
509
506
 
510
- # Returns the Reply-To value of the mail object, either a single string of an address
511
- # spec or an array of strings of address specs if there is more than one address
512
- # in the Reply-To.
507
+ # Returns the Reply-To value of the mail object as an array of strings of
508
+ # address specs.
513
509
  #
514
510
  # Example:
515
511
  #
516
512
  # mail.reply_to = 'Mikel <mikel@test.lindsaar.net>'
517
- # mail.reply_to #=> 'mikel@test.lindsaar.net'
513
+ # mail.reply_to #=> ['mikel@test.lindsaar.net']
518
514
  # mail.reply_to = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
519
515
  # mail.reply_to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
520
516
  #
@@ -523,7 +519,7 @@ module Mail
523
519
  # Example:
524
520
  #
525
521
  # mail.reply_to 'Mikel <mikel@test.lindsaar.net>'
526
- # mail.reply_to #=> 'mikel@test.lindsaar.net'
522
+ # mail.reply_to #=> ['mikel@test.lindsaar.net']
527
523
  def reply_to( val = nil )
528
524
  default :reply_to, val
529
525
  end
@@ -533,21 +529,20 @@ module Mail
533
529
  # Example:
534
530
  #
535
531
  # mail.reply_to = 'Mikel <mikel@test.lindsaar.net>'
536
- # mail.reply_to #=> 'mikel@test.lindsaar.net'
532
+ # mail.reply_to #=> ['mikel@test.lindsaar.net']
537
533
  # mail.reply_to = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
538
534
  # mail.reply_to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
539
535
  def reply_to=( val )
540
536
  header[:reply_to] = val
541
537
  end
542
538
 
543
- # Returns the Resent-Bcc value of the mail object, either a single string of an address
544
- # spec or an array of strings of address specs if there is more than one address
545
- # in the Resent-Bcc.
539
+ # Returns the Resent-Bcc value of the mail object as an array of strings of
540
+ # address specs.
546
541
  #
547
542
  # Example:
548
543
  #
549
544
  # mail.resent_bcc = 'Mikel <mikel@test.lindsaar.net>'
550
- # mail.resent_bcc #=> 'mikel@test.lindsaar.net'
545
+ # mail.resent_bcc #=> ['mikel@test.lindsaar.net']
551
546
  # mail.resent_bcc = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
552
547
  # mail.resent_bcc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
553
548
  #
@@ -556,7 +551,7 @@ module Mail
556
551
  # Example:
557
552
  #
558
553
  # mail.resent_bcc 'Mikel <mikel@test.lindsaar.net>'
559
- # mail.resent_bcc #=> 'mikel@test.lindsaar.net'
554
+ # mail.resent_bcc #=> ['mikel@test.lindsaar.net']
560
555
  def resent_bcc( val = nil )
561
556
  default :resent_bcc, val
562
557
  end
@@ -566,21 +561,20 @@ module Mail
566
561
  # Example:
567
562
  #
568
563
  # mail.resent_bcc = 'Mikel <mikel@test.lindsaar.net>'
569
- # mail.resent_bcc #=> 'mikel@test.lindsaar.net'
564
+ # mail.resent_bcc #=> ['mikel@test.lindsaar.net']
570
565
  # mail.resent_bcc = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
571
566
  # mail.resent_bcc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
572
567
  def resent_bcc=( val )
573
568
  header[:resent_bcc] = val
574
569
  end
575
570
 
576
- # Returns the Resent-Cc value of the mail object, either a single string of an address
577
- # spec or an array of strings of address specs if there is more than one address
578
- # in the Resent-Cc.
571
+ # Returns the Resent-Cc value of the mail object as an array of strings of
572
+ # address specs.
579
573
  #
580
574
  # Example:
581
575
  #
582
576
  # mail.resent_cc = 'Mikel <mikel@test.lindsaar.net>'
583
- # mail.resent_cc #=> 'mikel@test.lindsaar.net'
577
+ # mail.resent_cc #=> ['mikel@test.lindsaar.net']
584
578
  # mail.resent_cc = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
585
579
  # mail.resent_cc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
586
580
  #
@@ -589,7 +583,7 @@ module Mail
589
583
  # Example:
590
584
  #
591
585
  # mail.resent_cc 'Mikel <mikel@test.lindsaar.net>'
592
- # mail.resent_cc #=> 'mikel@test.lindsaar.net'
586
+ # mail.resent_cc #=> ['mikel@test.lindsaar.net']
593
587
  def resent_cc( val = nil )
594
588
  default :resent_cc, val
595
589
  end
@@ -599,7 +593,7 @@ module Mail
599
593
  # Example:
600
594
  #
601
595
  # mail.resent_cc = 'Mikel <mikel@test.lindsaar.net>'
602
- # mail.resent_cc #=> 'mikel@test.lindsaar.net'
596
+ # mail.resent_cc #=> ['mikel@test.lindsaar.net']
603
597
  # mail.resent_cc = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
604
598
  # mail.resent_cc #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
605
599
  def resent_cc=( val )
@@ -614,14 +608,13 @@ module Mail
614
608
  header[:resent_date] = val
615
609
  end
616
610
 
617
- # Returns the Resent-From value of the mail object, either a single string of an address
618
- # spec or an array of strings of address specs if there is more than one address
619
- # in the Resent-From.
611
+ # Returns the Resent-From value of the mail object as an array of strings of
612
+ # address specs.
620
613
  #
621
614
  # Example:
622
615
  #
623
616
  # mail.resent_from = 'Mikel <mikel@test.lindsaar.net>'
624
- # mail.resent_from #=> 'mikel@test.lindsaar.net'
617
+ # mail.resent_from #=> ['mikel@test.lindsaar.net']
625
618
  # mail.resent_from = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
626
619
  # mail.resent_from #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
627
620
  #
@@ -629,7 +622,7 @@ module Mail
629
622
  #
630
623
  # Example:
631
624
  #
632
- # mail.resent_from 'Mikel <mikel@test.lindsaar.net>'
625
+ # mail.resent_from ['Mikel <mikel@test.lindsaar.net>']
633
626
  # mail.resent_from #=> 'mikel@test.lindsaar.net'
634
627
  def resent_from( val = nil )
635
628
  default :resent_from, val
@@ -640,7 +633,7 @@ module Mail
640
633
  # Example:
641
634
  #
642
635
  # mail.resent_from = 'Mikel <mikel@test.lindsaar.net>'
643
- # mail.resent_from #=> 'mikel@test.lindsaar.net'
636
+ # mail.resent_from #=> ['mikel@test.lindsaar.net']
644
637
  # mail.resent_from = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
645
638
  # mail.resent_from #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
646
639
  def resent_from=( val )
@@ -683,14 +676,13 @@ module Mail
683
676
  header[:resent_sender] = val
684
677
  end
685
678
 
686
- # Returns the Resent-To value of the mail object, either a single string of an address
687
- # spec or an array of strings of address specs if there is more than one address
688
- # in the Resent-To.
679
+ # Returns the Resent-To value of the mail object as an array of strings of
680
+ # address specs.
689
681
  #
690
682
  # Example:
691
683
  #
692
684
  # mail.resent_to = 'Mikel <mikel@test.lindsaar.net>'
693
- # mail.resent_to #=> 'mikel@test.lindsaar.net'
685
+ # mail.resent_to #=> ['mikel@test.lindsaar.net']
694
686
  # mail.resent_to = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
695
687
  # mail.resent_to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
696
688
  #
@@ -699,7 +691,7 @@ module Mail
699
691
  # Example:
700
692
  #
701
693
  # mail.resent_to 'Mikel <mikel@test.lindsaar.net>'
702
- # mail.resent_to #=> 'mikel@test.lindsaar.net'
694
+ # mail.resent_to #=> ['mikel@test.lindsaar.net']
703
695
  def resent_to( val = nil )
704
696
  default :resent_to, val
705
697
  end
@@ -709,7 +701,7 @@ module Mail
709
701
  # Example:
710
702
  #
711
703
  # mail.resent_to = 'Mikel <mikel@test.lindsaar.net>'
712
- # mail.resent_to #=> 'mikel@test.lindsaar.net'
704
+ # mail.resent_to #=> ['mikel@test.lindsaar.net']
713
705
  # mail.resent_to = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
714
706
  # mail.resent_to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
715
707
  def resent_to=( val )
@@ -783,14 +775,13 @@ module Mail
783
775
  header[:subject] = val
784
776
  end
785
777
 
786
- # Returns the To value of the mail object, either a single string of an address
787
- # spec or an array of strings of address specs if there is more than one address
788
- # in the To.
778
+ # Returns the To value of the mail object as an array of strings of
779
+ # address specs.
789
780
  #
790
781
  # Example:
791
782
  #
792
783
  # mail.to = 'Mikel <mikel@test.lindsaar.net>'
793
- # mail.to #=> 'mikel@test.lindsaar.net'
784
+ # mail.to #=> ['mikel@test.lindsaar.net']
794
785
  # mail.to = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
795
786
  # mail.to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
796
787
  #
@@ -799,7 +790,7 @@ module Mail
799
790
  # Example:
800
791
  #
801
792
  # mail.to 'Mikel <mikel@test.lindsaar.net>'
802
- # mail.to #=> 'mikel@test.lindsaar.net'
793
+ # mail.to #=> ['mikel@test.lindsaar.net']
803
794
  def to( val = nil )
804
795
  default :to, val
805
796
  end
@@ -809,7 +800,7 @@ module Mail
809
800
  # Example:
810
801
  #
811
802
  # mail.to = 'Mikel <mikel@test.lindsaar.net>'
812
- # mail.to #=> 'mikel@test.lindsaar.net'
803
+ # mail.to #=> ['mikel@test.lindsaar.net']
813
804
  # mail.to = 'Mikel <mikel@test.lindsaar.net>, ada@test.lindsaar.net'
814
805
  # mail.to #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
815
806
  def to=( val )
@@ -1092,7 +1083,7 @@ module Mail
1092
1083
  if body.only_us_ascii?
1093
1084
  header[:content_type].parameters['charset'] = 'US-ASCII'
1094
1085
  else
1095
- warning = "Non US-ASCII detected and no charset defined.\nDefaulting to UTF-8, set your own if this is incorrect.\nCalled from:\n#{caller.join("\n")}"
1086
+ warning = "Non US-ASCII detected and no charset defined.\nDefaulting to UTF-8, set your own if this is incorrect.\n"
1096
1087
  STDERR.puts(warning)
1097
1088
  header[:content_type].parameters['charset'] = 'UTF-8'
1098
1089
  end
@@ -1105,7 +1096,7 @@ module Mail
1105
1096
  if body.only_us_ascii?
1106
1097
  header[:content_transfer_encoding] = '7bit'
1107
1098
  else
1108
- warning = "Non US-ASCII detected and no content-transfer-encoding defined.\nDefaulting to 8bit, set your own if this is incorrect.\nCalled from:\n#{caller.join("\n")}"
1099
+ warning = "Non US-ASCII detected and no content-transfer-encoding defined.\nDefaulting to 8bit, set your own if this is incorrect.\n"
1109
1100
  STDERR.puts(warning)
1110
1101
  header[:content_transfer_encoding] = '8bit'
1111
1102
  end
@@ -2,8 +2,8 @@
2
2
  module Mail
3
3
  module VERSION
4
4
  MAJOR = 1
5
- MINOR = 5
6
- TINY = 4
5
+ MINOR = 6
6
+ TINY = 0
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.4
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Lindsaar