@@ -509,9 +509,11 @@ def foo
509
509
510
510
get "/rails/mailers/notifier/foo"
511
511
assert_equal 200 , last_response . status
512
- assert_match "Ruby on Rails <[email protected] >" , last_response . body
513
- assert_match "Andrew White <[email protected] >" , last_response . body
514
- assert_match "David Heinemeier Hansson <[email protected] >" , last_response . body
512
+ assert_match '<dd id="from">Ruby on Rails <[email protected] ></dd>' , last_response . body
513
+ assert_match '<dd id="to">Andrew White <[email protected] ></dd>' , last_response . body
514
+ assert_match '<dd id="cc">David Heinemeier Hansson <[email protected] ></dd>' , last_response . body
515
+ assert_no_match '<dd id="smtp_from">' , last_response . body
516
+ assert_no_match '<dd id="smtp_to">' , last_response . body
515
517
516
518
get "/rails/mailers/download/notifier/foo"
517
519
email = Mail . read_from_string ( last_response . body )
@@ -521,6 +523,42 @@ def foo
521
523
assert_equal [ "[email protected] " ] , email . cc
522
524
end
523
525
526
+ test "message header shows SMTP envelope To and From when different than message headers" do
527
+ mailer "notifier" , <<-RUBY
528
+ class Notifier < ActionMailer::Base
529
+
530
+
531
+ def foo
532
+ message.smtp_envelope_from = "[email protected] "
533
+ message.smtp_envelope_to = ["[email protected] ", "[email protected] "]
534
+
535
+
536
+ end
537
+ end
538
+ RUBY
539
+
540
+ mailer_preview "notifier" , <<-RUBY
541
+ class NotifierPreview < ActionMailer::Preview
542
+ def foo
543
+ Notifier.foo
544
+ end
545
+ end
546
+ RUBY
547
+
548
+ text_template "notifier/foo" , <<-RUBY
549
+ Hello, World!
550
+ RUBY
551
+
552
+ app ( "development" )
553
+
554
+ get "/rails/mailers/notifier/foo"
555
+ assert_equal 200 , last_response . status
556
+ assert_match '<dd id="from">[email protected] </dd>' , last_response . body
557
+ assert_match '<dd id="smtp_from">[email protected] </dd>' , last_response . body
558
+ assert_match '<dd id="to">[email protected] </dd>' , last_response . body
559
+ assert_match '<dd id="smtp_to">[email protected] , [email protected] </dd>' , last_response . body
560
+ end
561
+
524
562
test "part menu selects correct option" do
525
563
mailer "notifier" , <<-RUBY
526
564
class Notifier < ActionMailer::Base
0 commit comments