mail 2.8.0.rc1 → 2.8.0.rc3

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: 6ed25dc984368dd9a0032804a298eb6120e860357a70e7afc170108c700d430e
4
- data.tar.gz: 886556ae37645a3074ca43cf439388c4bcdd164cc4849de76df4cf19345f8893
3
+ metadata.gz: ac99b70fae085914a2fbc153a38f199ddda35671f0e488b6ae6b578c16ef868e
4
+ data.tar.gz: 031535fbd036e814e7619a7f4a0e353cfdd64460ed8904525da349d691f92bfe
5
5
  SHA512:
6
- metadata.gz: 545f9b3a4a2cb1e752bad67e09cc0f3587d352471db140a35c6b885a9e64e5998b65032ff0d61f731bd1c27ed9a70a46a84c62051c5e419d99e7bf9a14dadbce
7
- data.tar.gz: 727057fbad623dc4eef62840a2b8a5cf65e6c8d469874d497de91e78c2df9ccdbde5090fdffb7b8843ca4e7416c04ca34ab8b544e848dbd62ec25751ac8649ed
6
+ metadata.gz: 4beae958c4b21822b7739401118b515d4b02d9dbdb5b37135a60da5aa647eb8b905937a0c45e093c6deca134355e53340208cd321816bde3cdec12cb6197b96b
7
+ data.tar.gz: 5155f9bb2fa57c864b4c42faaf0c2981724c7db2664eebe41c6c09139c8f23f02a3409bcea202676dd783fb660659f6a7ff839d320a9ffa3fe4c19b289f77aeb
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # This whole class and associated specs is deprecated and will go away in the version 3 release of mail.
4
+ module Mail
5
+ module CheckDeliveryParams #:nodoc:
6
+ class << self
7
+
8
+ extend Gem::Deprecate
9
+
10
+ def check(mail)
11
+ envelope = Mail::SmtpEnvelope.new(mail)
12
+ [ envelope.from,
13
+ envelope.to,
14
+ envelope.message ]
15
+ end
16
+ deprecate :check, 'Mail::SmtpEnvelope.new created in commit c106bebea066782a72e4f24dd37b532d95773df7', 2023, 6
17
+
18
+ def check_from(addr)
19
+ mail = Mail.new(from: 'deprecated@example.com', to: 'deprecated@example.com')
20
+ Mail::SmtpEnvelope.new(mail).send(:validate_addr, 'From', addr)
21
+ end
22
+ deprecate :check_from, :none, 2023, 6
23
+
24
+ def check_to(addrs)
25
+ mail = Mail.new(from: 'deprecated@example.com', to: 'deprecated@example.com')
26
+ Array(addrs).map do |addr|
27
+ Mail::SmtpEnvelope.new(mail).send(:validate_addr, 'To', addr)
28
+ end
29
+ end
30
+ deprecate :check_to, :none, 2023, 6
31
+
32
+ def check_addr(addr_name, addr)
33
+ mail = Mail.new(from: 'deprecated@example.com', to: 'deprecated@example.com')
34
+ Mail::SmtpEnvelope.new(mail).send(:validate_addr, addr_name, addr)
35
+ end
36
+ deprecate :check_addr, :none, 2023, 6
37
+
38
+ def validate_smtp_addr(addr)
39
+ if addr
40
+ if addr.bytesize > 2048
41
+ yield 'may not exceed 2kB'
42
+ end
43
+
44
+ if /[\r\n]/ =~ addr
45
+ yield 'may not contain CR or LF line breaks'
46
+ end
47
+ end
48
+
49
+ addr
50
+ end
51
+ deprecate :validate_smtp_addr, :none, 2023, 6
52
+
53
+ def check_message(message)
54
+ message = message.encoded if message.respond_to?(:encoded)
55
+
56
+ if Utilities.blank?(message)
57
+ raise ArgumentError, 'An encoded message is required to send an email'
58
+ end
59
+
60
+ message
61
+ end
62
+ deprecate :check_message, :none, 2023, 6
63
+ end
64
+ end
65
+ end
data/lib/mail/message.rb CHANGED
@@ -1496,7 +1496,7 @@ module Mail
1496
1496
  # Returns the character set defined in the content type field
1497
1497
  def charset
1498
1498
  if @header
1499
- has_content_type? ? content_type_parameters['charset'] : @charset
1499
+ has_content_type? && !multipart? ? content_type_parameters['charset'] : @charset
1500
1500
  else
1501
1501
  @charset
1502
1502
  end
@@ -2066,7 +2066,11 @@ module Mail
2066
2066
 
2067
2067
  def add_boundary
2068
2068
  unless body.boundary && boundary
2069
- header['content-type'] = 'multipart/mixed' unless header['content-type']
2069
+ unless header['content-type']
2070
+ _charset = charset
2071
+ header['content-type'] = 'multipart/mixed'
2072
+ header['content-type'].parameters[:charset] = _charset
2073
+ end
2070
2074
  header['content-type'].parameters[:boundary] = ContentTypeField.generate_boundary
2071
2075
  body.boundary = boundary
2072
2076
  end
@@ -111,17 +111,33 @@ module Mail
111
111
 
112
112
  def build_smtp_session
113
113
  Net::SMTP.new(settings[:address], settings[:port]).tap do |smtp|
114
- if settings[:tls] || settings[:ssl]
115
- if smtp.respond_to?(:enable_tls)
114
+ tls = settings[:tls] || settings[:ssl]
115
+ if !tls.nil?
116
+ case tls
117
+ when true
116
118
  smtp.enable_tls(ssl_context)
119
+ when false
120
+ smtp.disable_tls
121
+ else
122
+ raise ArgumentError, "Unrecognized :tls value #{settings[:tls].inspect}; expected true, false, or nil"
117
123
  end
118
- elsif settings[:enable_starttls]
119
- if smtp.respond_to?(:enable_starttls)
124
+ elsif settings.include?(:enable_starttls) && !settings[:enable_starttls].nil?
125
+ case settings[:enable_starttls]
126
+ when true
120
127
  smtp.enable_starttls(ssl_context)
128
+ when false
129
+ smtp.disable_starttls
130
+ else
131
+ raise ArgumentError, "Unrecognized :enable_starttls value #{settings[:enable_starttls].inspect}; expected true, false, or nil"
121
132
  end
122
- elsif settings[:enable_starttls_auto]
123
- if smtp.respond_to?(:enable_starttls_auto)
133
+ elsif settings.include?(:enable_starttls_auto) && !settings[:enable_starttls_auto].nil?
134
+ case settings[:enable_starttls_auto]
135
+ when true
124
136
  smtp.enable_starttls_auto(ssl_context)
137
+ when false
138
+ smtp.disable_starttls_auto
139
+ else
140
+ raise ArgumentError, "Unrecognized :enable_starttls_auto value #{settings[:enable_starttls_auto].inspect}; expected true, false, or nil"
125
141
  end
126
142
  end
127
143
 
data/lib/mail/version.rb CHANGED
@@ -5,7 +5,7 @@ module Mail
5
5
  MAJOR = 2
6
6
  MINOR = 8
7
7
  PATCH = 0
8
- BUILD = 'rc1'
8
+ BUILD = 'rc3'
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
11
11
 
data/lib/mail.rb CHANGED
@@ -60,6 +60,9 @@ module Mail # :doc:
60
60
  require 'mail/matchers/has_sent_mail'
61
61
  require 'mail/matchers/attachment_matchers.rb'
62
62
 
63
+ # Deprecated will be removed in 3.0 release
64
+ require 'mail/check_delivery_params'
65
+
63
66
  # Finally... require all the Mail.methods
64
67
  require 'mail/mail'
65
68
  end
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.rc1
4
+ version: 2.8.0.rc3
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-04-22 00:00:00.000000000 Z
11
+ date: 2022-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_mime
@@ -162,6 +162,7 @@ files:
162
162
  - lib/mail.rb
163
163
  - lib/mail/attachments_list.rb
164
164
  - lib/mail/body.rb
165
+ - lib/mail/check_delivery_params.rb
165
166
  - lib/mail/configuration.rb
166
167
  - lib/mail/constants.rb
167
168
  - lib/mail/elements.rb
@@ -313,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
314
  - !ruby/object:Gem::Version
314
315
  version: 1.3.1
315
316
  requirements: []
316
- rubygems_version: 3.0.8
317
+ rubygems_version: 3.1.6
317
318
  signing_key:
318
319
  specification_version: 4
319
320
  summary: Mail provides a nice Ruby DSL for making, sending and reading emails.