mail 2.8.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa5b2d445e65e58dc7c1716cd6f2eebd4f2397548eb1aa1d9230222df09f6aa3
4
- data.tar.gz: cae304c28819a9903baf718616f8bb94e2ea860b0b2db43bfb3a3e0f9f12eaac
3
+ metadata.gz: ea4015fe2858f6c1b123e04d4d407169567b1aeea1155b7b145fe75d9d3781b5
4
+ data.tar.gz: 20cdb386c2f878560b9f61ab63b4f0c264c9f9115af5c835b8c66f49486cb274
5
5
  SHA512:
6
- metadata.gz: b72cc59bc03570e9f5347d796e38b6d4365143a7122e7353559314e82b2523479fb5adf90fce65d1d8a5c7e95a97964b2118c082de5b6bb535f663bf4056fa8f
7
- data.tar.gz: 64157d336e45117c5e32db4a599ccf97e3b8b6aa2c761b4d5923f18b6b506ee8a20795ce5e9e8494c4d39c7c4784e2317da7674d89ffc75cb5fd6d19f5473073
6
+ metadata.gz: b2eb55bc6f51b2d93e6d6abed5bb74876b3f96fd1eea00105047b3a211007b2b906ac89bcd1bed52603c211c595d439b6642bd897943decbcc9ac541f88e2049
7
+ data.tar.gz: 063dd68ef655b93d96412bdcf66ab6f191eaf0bfbafa10730ecfa99a447eb3d2a4469d6d1de67ae144bbaada65eaec4c7d8dbb5fe04509146dc1434a5c557fff
data/README.md CHANGED
@@ -47,7 +47,21 @@ our documentation, add new features—up to you! Thank you for pitching in.
47
47
 
48
48
  ## Compatibility
49
49
 
50
- Mail supports Ruby 2.5+, including JRuby and TruffleRuby.
50
+ Mail is tested against:
51
+
52
+ * Ruby: 2.5
53
+ * Ruby: 2.6
54
+ * Ruby: 2.7
55
+ * Ruby: 3.0
56
+ * Ruby: 3.1
57
+ * Ruby: 3.2
58
+ * JRuby: 9.2
59
+ * JRuby: 9.3
60
+ * JRuby: 9.4
61
+ * JRuby: stable
62
+ * JRuby: head
63
+ * Truffleruby: stable
64
+ * Truffleruby: head
51
65
 
52
66
  As new versions of Ruby are released, Mail will be compatible with support for the "preview" and all "normal maintenance", "security maintenance" and the two most recent "end of life" versions listed at the [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/) page. Pull requests to assist in adding support for new preview releases are more than welcome.
53
67
 
@@ -49,8 +49,12 @@ module Mail
49
49
  end
50
50
 
51
51
  def initialize(values)
52
+ if values[:arguments].is_a?(String)
53
+ deprecation_warn.call \
54
+ 'Initializing Mail::Sendmail with :arguments of type String is deprecated.' \
55
+ ' Instead ensure :arguments is an array of strings, e.g. ["-i", "-t"]'
56
+ end
52
57
  self.settings = self.class::DEFAULTS.merge(values)
53
- raise ArgumentError, ":arguments expected to be an Array of individual string args" if settings[:arguments].is_a?(String)
54
58
  end
55
59
 
56
60
  def destinations_for(envelope)
@@ -60,8 +64,13 @@ module Mail
60
64
  def deliver!(mail)
61
65
  envelope = Mail::SmtpEnvelope.new(mail)
62
66
 
67
+ arguments = settings[:arguments]
68
+ if arguments.is_a? String
69
+ return old_deliver(envelope)
70
+ end
71
+
63
72
  command = [settings[:location]]
64
- command.concat Array(settings[:arguments])
73
+ command.concat Array(arguments)
65
74
  command.concat [ '-f', envelope.from ] if envelope.from
66
75
 
67
76
  if destinations = destinations_for(envelope)
@@ -83,5 +92,42 @@ module Mail
83
92
  end
84
93
  end
85
94
  end
95
+
96
+ #+ support for delivery using string arguments (deprecated)
97
+ def old_deliver(envelope)
98
+ smtp_from = envelope.from
99
+ smtp_to = destinations_for(envelope)
100
+
101
+ from = "-f #{shellquote(smtp_from)}" if smtp_from
102
+ destination = smtp_to.map { |to| shellquote(to) }.join(' ')
103
+
104
+ arguments = "#{settings[:arguments]} #{from} --"
105
+ command = "#{settings[:location]} #{arguments} #{destination}"
106
+ popen command do |io|
107
+ io.puts ::Mail::Utilities.binary_unsafe_to_lf(envelope.message)
108
+ io.flush
109
+ end
110
+ end
111
+
112
+ # The following is an adaptation of ruby 1.9.2's shellwords.rb file,
113
+ # with the following modifications:
114
+ #
115
+ # - Wraps in double quotes
116
+ # - Allows '+' to accept email addresses with them
117
+ # - Allows '~' as it is not unescaped in double quotes
118
+ def shellquote(address)
119
+ # Process as a single byte sequence because not all shell
120
+ # implementations are multibyte aware.
121
+ #
122
+ # A LF cannot be escaped with a backslash because a backslash + LF
123
+ # combo is regarded as line continuation and simply ignored. Strip it.
124
+ escaped = address.gsub(/([^A-Za-z0-9_\s\+\-.,:\/@~])/n, "\\\\\\1").gsub("\n", '')
125
+ %("#{escaped}")
126
+ end
127
+ #- support for delivery using string arguments
128
+
129
+ def deprecation_warn
130
+ defined?(ActiveSupport::Deprecation.warn) ? ActiveSupport::Deprecation.method(:warn) : Kernel.method(:warn)
131
+ end
86
132
  end
87
133
  end
@@ -135,7 +135,7 @@ module Mail
135
135
  when true
136
136
  smtp.enable_starttls_auto(ssl_context)
137
137
  when false
138
- smtp.disable_starttls_auto
138
+ smtp.disable_starttls
139
139
  else
140
140
  raise ArgumentError, "Unrecognized :enable_starttls_auto value #{settings[:enable_starttls_auto].inspect}; expected true, false, or nil"
141
141
  end
data/lib/mail/version.rb CHANGED
@@ -4,7 +4,7 @@ module Mail
4
4
 
5
5
  MAJOR = 2
6
6
  MINOR = 8
7
- PATCH = 0
7
+ PATCH = 1
8
8
  BUILD = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
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.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikel Lindsaar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-03 00:00:00.000000000 Z
11
+ date: 2023-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_mime