diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index ce539e6f66a..32d06d6bd55 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,7 @@ +* Show BCC recipients when present in Action Mailer previews. + + *Akshay Birajdar* + * Extend `routes --grep` to also filter routes by matching against path. Example: diff --git a/railties/lib/rails/templates/rails/mailers/email.html.erb b/railties/lib/rails/templates/rails/mailers/email.html.erb index 59c2f283df0..0c5ff765d4f 100644 --- a/railties/lib/rails/templates/rails/mailers/email.html.erb +++ b/railties/lib/rails/templates/rails/mailers/email.html.erb @@ -80,6 +80,11 @@
<%= @email.header['cc'] %>
<% end %> + <% if @email.bcc %> +
BCC:
+
<%= @email.header['bcc'] %>
+ <% end %> +
Date:
<%= Time.current.rfc2822 %>
diff --git a/railties/test/application/mailer_previews_test.rb b/railties/test/application/mailer_previews_test.rb index 4651120b23a..354bf911824 100644 --- a/railties/test/application/mailer_previews_test.rb +++ b/railties/test/application/mailer_previews_test.rb @@ -877,6 +877,36 @@ module ApplicationTests assert_match "Mailer Preview for notifier#foo", last_response.body end + test "mailer preview sender tags" do + mailer "notifier", <<-RUBY + class Notifier < ActionMailer::Base + default from: "from@example.com" + def foo + mail to: "to@example.org", cc: "cc@example.com", bcc: "bcc@example.com" + end + end + RUBY + + text_template "notifier/foo", <<-RUBY + Hello, World! + RUBY + + mailer_preview "notifier", <<-RUBY + class NotifierPreview < ActionMailer::Preview + def foo + Notifier.foo + end + end + RUBY + + app("development") + + get "/rails/mailers/notifier/foo" + assert_match "
to@example.org
", last_response.body + assert_match "
cc@example.com
", last_response.body + assert_match "
bcc@example.com
", last_response.body + end + private def build_app super