lib/backup/notifier/mail.rb in backup-3.6.0 vs lib/backup/notifier/mail.rb in backup-3.7.0
- old
+ new
@@ -238,5 +238,43 @@
}
end
end
end
+
+# Patch mail v2.5.4 Exim delivery method
+# https://github.com/meskyanichi/backup/issues/446
+# https://github.com/mikel/mail/pull/546
+module Mail
+ class Exim
+ def self.call(path, arguments, destinations, encoded_message)
+ popen "#{path} #{arguments}" do |io|
+ io.puts encoded_message.to_lf
+ io.flush
+ end
+ end
+ end
+end
+
+# Patch mail v2.5.4 for ruby-1.8.7
+# https://github.com/mikel/mail/issues/548
+# https://github.com/mikel/mail/commit/c7318a6c03c1ecb3f574ccd2e3f06778687d1d15
+if RUBY_VERSION < '1.9'
+ module Mail
+ class SMTP
+ private
+ def ssl_context
+ openssl_verify_mode = settings[:openssl_verify_mode]
+
+ if openssl_verify_mode.kind_of?(String)
+ openssl_verify_mode = "OpenSSL::SSL::VERIFY_#{openssl_verify_mode.upcase}".constantize
+ end
+
+ context = Net::SMTP.default_ssl_context
+ context.verify_mode = openssl_verify_mode
+ context.ca_path = settings[:ca_path] if settings[:ca_path]
+ context.ca_file = settings[:ca_file] if settings[:ca_file]
+ context
+ end
+ end
+ end
+end