Skip to content

Commit 2c503ae

Browse files
authored
Merge pull request rails#46650 from andynu/mail-2-8-0-sendmail-options
Change sendmail default options to match Mail 2.8.x arguments format.
2 parents b02c77f + 0398459 commit 2c503ae

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

Gemfile.lock

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,11 @@ GEM
314314
loofah (2.13.0)
315315
crass (~> 1.0.2)
316316
nokogiri (>= 1.5.9)
317-
mail (2.7.1)
317+
mail (2.8.0)
318318
mini_mime (>= 0.1.1)
319+
net-imap
320+
net-pop
321+
net-smtp
319322
marcel (1.0.2)
320323
matrix (0.4.2)
321324
memoist (0.16.2)

actionmailer/lib/action_mailer/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ module ActionMailer
439439
#
440440
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
441441
# * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
442-
# * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i</tt> with <tt>-f sender@address</tt>
442+
# * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>%w[ -i ]</tt> with <tt>-f sender@address</tt>
443443
# added automatically before the message is sent.
444444
#
445445
# * <tt>file_settings</tt> - Allows you to override options for the <tt>:file</tt> delivery method.

actionmailer/lib/action_mailer/delivery_methods.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ module DeliveryMethods
3131

3232
add_delivery_method :sendmail, Mail::Sendmail,
3333
location: "/usr/sbin/sendmail",
34-
arguments: "-i"
34+
# See breaking change in the mail gem - https://github.com/mikel/mail/commit/7e1196bd29815a0901d7290c82a332c0959b163a
35+
arguments: Gem::Version.new(Mail::VERSION.version) >= Gem::Version.new("2.8.0") ? %w[-i] : "-i"
3536

3637
add_delivery_method :test, Mail::TestMailer
3738
end
@@ -46,7 +47,7 @@ module ClassMethods
4647
#
4748
# add_delivery_method :sendmail, Mail::Sendmail,
4849
# location: '/usr/sbin/sendmail',
49-
# arguments: '-i'
50+
# arguments: %w[ -i ]
5051
def add_delivery_method(symbol, klass, default_options = {})
5152
class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
5253
public_send(:"#{symbol}_settings=", default_options)

actionmailer/test/delivery_methods_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class DefaultsDeliveryMethodsTest < ActiveSupport::TestCase
4141
test "default sendmail settings" do
4242
settings = {
4343
location: "/usr/sbin/sendmail",
44-
arguments: "-i"
44+
arguments: %w[ -i ]
4545
}
4646
assert_equal settings, ActionMailer::Base.sendmail_settings
4747
end

guides/source/action_mailer_basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ config.action_mailer.delivery_method = :sendmail
839839
# Defaults to:
840840
# config.action_mailer.sendmail_settings = {
841841
# location: '/usr/sbin/sendmail',
842-
# arguments: '-i'
842+
# arguments: %w[ -i ]
843843
# }
844844
config.action_mailer.perform_deliveries = true
845845
config.action_mailer.raise_delivery_errors = true

guides/source/configuring.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1910,7 +1910,7 @@ The default value depends on the `config.load_defaults` target version:
19101910
Allows detailed configuration for the `sendmail` delivery method. It accepts a hash of options, which can include any of these options:
19111911

19121912
* `:location` - The location of the sendmail executable. Defaults to `/usr/sbin/sendmail`.
1913-
* `:arguments` - The command line arguments. Defaults to `-i`.
1913+
* `:arguments` - The command line arguments. Defaults to `%w[ -i ]`.
19141914

19151915
#### `config.action_mailer.raise_delivery_errors`
19161916

0 commit comments

Comments
 (0)