Commit ef903ba7 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Adds :async_smtp and :async_sendmail delivery methods to perform email deliveries asynchronously.

Code from http://www.datanoise.com/articles/2006/7/14/asynchronous-email-delivery.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2339 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent da941734
......@@ -15,3 +15,17 @@ ActiveRecord::Errors.default_error_messages = {
} if ActiveRecord::Errors.respond_to?('default_error_messages=')
ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "#{html_tag}" }
# Adds :async_smtp and :async_sendmail delivery methods
# to perform email deliveries asynchronously
module AsynchronousMailer
%w(smtp sendmail).each do |type|
define_method("perform_delivery_async_#{type}") do |mail|
Thread.start do
send "perform_delivery_#{type}", mail
end
end
end
end
ActionMailer::Base.send :include, AsynchronousMailer
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment