Skip to content

Commit b4fd5e6

Browse files
committed
template_name and template_path should not be added to mail headers.
1 parent 518891f commit b4fd5e6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

actionmailer/lib/action_mailer/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def mail(headers={}, &block)
541541
wrap_delivery_behavior!(headers.delete(:delivery_method))
542542

543543
# Assign all headers except parts_order, content_type and body
544-
assignable = headers.except(:parts_order, :content_type, :body)
544+
assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path)
545545
assignable.each { |k, v| m[k] = v }
546546

547547
# Render the templates and blocks

actionmailer/test/base_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,28 +510,28 @@ def different_layout(layout_name='')
510510

511511
# Rendering
512512
test "you can specify a different template for implicit render" do
513-
mail = BaseMailer.implicit_different_template('implicit_multipart')
513+
mail = BaseMailer.implicit_different_template('implicit_multipart').deliver
514514
assert_equal("HTML Implicit Multipart", mail.html_part.body.decoded)
515515
assert_equal("TEXT Implicit Multipart", mail.text_part.body.decoded)
516516
end
517517

518518
test "you can specify a different template for explicit render" do
519-
mail = BaseMailer.explicit_different_template('explicit_multipart_templates')
519+
mail = BaseMailer.explicit_different_template('explicit_multipart_templates').deliver
520520
assert_equal("HTML Explicit Multipart Templates", mail.html_part.body.decoded)
521521
assert_equal("TEXT Explicit Multipart Templates", mail.text_part.body.decoded)
522522
end
523523

524524
test "you can specify a different layout" do
525-
mail = BaseMailer.different_layout('different_layout')
525+
mail = BaseMailer.different_layout('different_layout').deliver
526526
assert_equal("HTML -- HTML", mail.html_part.body.decoded)
527527
assert_equal("PLAIN -- PLAIN", mail.text_part.body.decoded)
528528
end
529529

530530
test "you can specify the template path for implicit lookup" do
531-
mail = BaseMailer.welcome_from_another_path('another.path/base_mailer')
531+
mail = BaseMailer.welcome_from_another_path('another.path/base_mailer').deliver
532532
assert_equal("Welcome from another path", mail.body.encoded)
533533

534-
mail = BaseMailer.welcome_from_another_path(['unknown/invalid', 'another.path/base_mailer'])
534+
mail = BaseMailer.welcome_from_another_path(['unknown/invalid', 'another.path/base_mailer']).deliver
535535
assert_equal("Welcome from another path", mail.body.encoded)
536536
end
537537

0 commit comments

Comments
 (0)