aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2009-12-04 00:33:31 +0000
committerFrancis Irving <francis@mysociety.org>2009-12-04 00:33:31 +0000
commit130d32b875b448e8f2aadfba9c0dcd2923f62fa7 (patch)
treebf8009c0c011f26ca5b59f20f011575a7f9108c6 /lib
parent7f4563d2a13b5a13649db50f1f2dc166220bbab5 (diff)
Make fix for return path when using sendmail have test
Diffstat (limited to 'lib')
-rw-r--r--lib/sendmail_return_path.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/sendmail_return_path.rb b/lib/sendmail_return_path.rb
new file mode 100644
index 000000000..f9ddba5b4
--- /dev/null
+++ b/lib/sendmail_return_path.rb
@@ -0,0 +1,21 @@
+# 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.rb
+
+module ActionMailer
+ class Base
+ def perform_delivery_sendmail(mail)
+ sender = (mail['return-path'] && mail['return-path'].spec) || mail.from
+
+ 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
+