From 250dfb18afb58dda3caf4b9f170ddb9c5cf85faf Mon Sep 17 00:00:00 2001 From: Matt Jones Date: Tue, 3 Feb 2009 14:58:20 -0500 Subject: Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP [#1842 state:committed] Signed-off-by: David Heinemeier Hansson --- actionmailer/CHANGELOG | 5 +++++ actionmailer/lib/action_mailer/base.rb | 2 +- actionmailer/test/mail_service_test.rb | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index ecfa25b0a0..457e9aca94 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -1,3 +1,8 @@ +*Edge* + +* Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones] + + *2.3.0 [RC1] (February 1st, 2009)* * Fixed RFC-2045 quoted-printable bug #1421 [squadette] diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index eda5de4e18..f421945763 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -672,7 +672,7 @@ module ActionMailer #:nodoc: def perform_delivery_smtp(mail) destinations = mail.destinations mail.ready_to_send - sender = mail['return-path'] || mail.from + sender = (mail['return-path'] && mail['return-path'].spec) || mail.from smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port]) smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto) diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 79ade38155..1e04531753 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -938,6 +938,7 @@ EOF ActionMailer::Base.delivery_method = :smtp TestMailer.deliver_return_path assert_match %r{^Return-Path: }, MockSMTP.deliveries[0][0] + assert_equal "another@somewhere.test", MockSMTP.deliveries[0][1].to_s end def test_body_is_stored_as_an_ivar -- cgit v1.2.3