diff options
-rw-r--r-- | config/initializers/alaveteli.rb | 1 | ||||
-rw-r--r-- | lib/sendmail_return_path.rb | 21 | ||||
-rw-r--r-- | spec/lib/sendmail_return_path_spec.rb | 7 |
3 files changed, 6 insertions, 23 deletions
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index 56a2bce63..f1a59109f 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -72,7 +72,6 @@ require 'use_spans_for_errors.rb' require 'make_html_4_compliant.rb' require 'activerecord_errors_extensions.rb' require 'willpaginate_extension.rb' -require 'sendmail_return_path.rb' require 'i18n_fixes.rb' require 'rack_quote_monkeypatch.rb' require 'world_foi_websites.rb' diff --git a/lib/sendmail_return_path.rb b/lib/sendmail_return_path.rb deleted file mode 100644 index 23c4d4376..000000000 --- a/lib/sendmail_return_path.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Monkeypatch! -# Grrr, semantics of smtp and sendmail send should be the same with regard to setting return path - -# See test in spec/lib/sendmail_return_path_spec.rb - -module ActionMailer - class Base - def perform_delivery_sendmail(mail) - sender = (mail['return-path'] && mail['return-path'].spec) || mail.from.first - - sendmail_args = sendmail_settings[:arguments].dup - sendmail_args += " -f \"#{sender}\"" - - IO.popen("#{sendmail_settings[:location]} #{sendmail_args}","w+") do |sm| - sm.print(mail.encoded.gsub(/\r/, '')) - sm.flush - end - end - end -end - diff --git a/spec/lib/sendmail_return_path_spec.rb b/spec/lib/sendmail_return_path_spec.rb index 137869b6e..b4bdda12c 100644 --- a/spec/lib/sendmail_return_path_spec.rb +++ b/spec/lib/sendmail_return_path_spec.rb @@ -1,5 +1,10 @@ # This is a test of the monkey patches in sendmail_return_path.rb +# In Rails 3 the monkeypatches are not needed anymore because sendmail now has the "-f" flag +# set correctly. So, strictly these tests are testing the Rails internals. So, that means we really +# should delete them. Let's do that later when things have settled down. For the time being leave +# them in + require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe "when sending email with an altered return path" do @@ -40,7 +45,7 @@ describe "when sending email with an altered return path" do it "should set the return path when sending email using sendmail" do with_stub_popen do - IO.should_receive(:popen).once.with('/usr/sbin/sendmail -i -t -f "test@localhost"', "w+") + IO.should_receive(:popen).once.with('/usr/sbin/sendmail -i -t -f "test@localhost" postmaster@localhost', "w+") with_delivery_method :sendmail do ContactMailer.deliver_to_admin_message( "Mr. Test", "test@localhost", "Test script spec/lib/sendmail_return_path_spec.rb", |