From fecbed6fb136a2f951633bd5b9632e75cc46f804 Mon Sep 17 00:00:00 2001 From: Mark Dodwell Date: Sat, 20 Dec 2014 15:50:09 -0800 Subject: [PATCH] Add support for Reply-To field in mail_to helper --- actionview/lib/action_view/helpers/url_helper.rb | 5 +++-- actionview/test/template/url_helper_test.rb | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index 364414da05..8c2d5705f1 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -428,6 +428,7 @@ def link_to_if(condition, name, options = {}, html_options = {}, &block) # * :body - Preset the body of the email. # * :cc - Carbon Copy additional recipients on the email. # * :bcc - Blind Carbon Copy additional recipients on the email. + # * :reply_to - Preset the Reply-To field of the email. # # ==== Obfuscation # Prior to Rails 4.0, +mail_to+ provided options for encoding the address @@ -457,9 +458,9 @@ def mail_to(email_address, name = nil, html_options = {}, &block) html_options, name = name, nil if block_given? html_options = (html_options || {}).stringify_keys - extras = %w{ cc bcc body subject }.map! { |item| + extras = %w{ cc bcc body subject reply_to }.map! { |item| option = html_options.delete(item) || next - "#{item}=#{Rack::Utils.escape_path(option)}" + "#{item.dasherize}=#{Rack::Utils.escape_path(option)}" }.compact extras = extras.empty? ? '' : '?' + extras.join('&') diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index e0678ae1f7..0d6f31af9b 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -493,8 +493,8 @@ def test_mail_to def test_mail_with_options assert_dom_equal( - %{My email}, - mail_to("me@example.com", "My email", cc: "ccaddress@example.com", bcc: "bccaddress@example.com", subject: "This is an example email", body: "This is the body of the message.") + %{My email}, + mail_to("me@example.com", "My email", cc: "ccaddress@example.com", bcc: "bccaddress@example.com", subject: "This is an example email", body: "This is the body of the message.", reply_to: "foo@bar.com") ) end -- GitLab