Merge pull request #46650 from andynu/mail-2-8-0-sendmail-options

Change sendmail default options to match Mail 2.8.x arguments format.
This commit is contained in:
Jean Boussier 2022-12-08 11:13:21 +01:00 committed by GitHub
commit 2c503ae8b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 7 deletions

View File

@ -314,8 +314,11 @@ GEM
loofah (2.13.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mail (2.8.0)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
matrix (0.4.2)
memoist (0.16.2)

View File

@ -439,7 +439,7 @@ module ActionMailer
#
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
# * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
# * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i</tt> with <tt>-f sender@address</tt>
# * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>%w[ -i ]</tt> with <tt>-f sender@address</tt>
# added automatically before the message is sent.
#
# * <tt>file_settings</tt> - Allows you to override options for the <tt>:file</tt> delivery method.

View File

@ -31,7 +31,8 @@ module ActionMailer
add_delivery_method :sendmail, Mail::Sendmail,
location: "/usr/sbin/sendmail",
arguments: "-i"
# See breaking change in the mail gem - https://github.com/mikel/mail/commit/7e1196bd29815a0901d7290c82a332c0959b163a
arguments: Gem::Version.new(Mail::VERSION.version) >= Gem::Version.new("2.8.0") ? %w[-i] : "-i"
add_delivery_method :test, Mail::TestMailer
end
@ -46,7 +47,7 @@ module ActionMailer
#
# add_delivery_method :sendmail, Mail::Sendmail,
# location: '/usr/sbin/sendmail',
# arguments: '-i'
# arguments: %w[ -i ]
def add_delivery_method(symbol, klass, default_options = {})
class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
public_send(:"#{symbol}_settings=", default_options)

View File

@ -41,7 +41,7 @@ class DefaultsDeliveryMethodsTest < ActiveSupport::TestCase
test "default sendmail settings" do
settings = {
location: "/usr/sbin/sendmail",
arguments: "-i"
arguments: %w[ -i ]
}
assert_equal settings, ActionMailer::Base.sendmail_settings
end

View File

@ -839,7 +839,7 @@ config.action_mailer.delivery_method = :sendmail
# Defaults to:
# config.action_mailer.sendmail_settings = {
# location: '/usr/sbin/sendmail',
# arguments: '-i'
# arguments: %w[ -i ]
# }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

View File

@ -1910,7 +1910,7 @@ The default value depends on the `config.load_defaults` target version:
Allows detailed configuration for the `sendmail` delivery method. It accepts a hash of options, which can include any of these options:
* `:location` - The location of the sendmail executable. Defaults to `/usr/sbin/sendmail`.
* `:arguments` - The command line arguments. Defaults to `-i`.
* `:arguments` - The command line arguments. Defaults to `%w[ -i ]`.
#### `config.action_mailer.raise_delivery_errors`