aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
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
+