backgroundrb requires you to run a separate backgroundrb process,
ar_mailer requires you to set up another database table for queueing
the mail, and then running a cron job at a specified interval to send
all the queued mail
In my case i used the Thread method.
In this example i use msmtp, and send my email via GMail.
In environment.rb
ActionMailer::Base.delivery_method = :msmtp
module ActionMailer
class Base
def perform_delivery_msmtp(mail)
thread = Thread.new do
IO.popen("/usr/bin/msmtp -t -C /etc/.msmtprc -a gmail --",
"w") do
>sm>
sm.puts(mail.encoded.gsub(/\r/, ''))
sm.flush
end
end
thread.run
end
end
end