I am using a button for report abuse, clicking on which ajax call goes to controller and after inserting post as abused in database it is returning success. On successful response it is displaying on UI topic as abused. Now i want to send mails to admin about this. I have integrated mailer in controller, i.e. on success mailer code executes and mails are send to admin.
Now problem is that sending mails take too much time, so my ajax response time also increases. What I want is that mailer code should execute after controller sends its response, so that response time should decrease.
Thanks
We use resque mailer - https://github.com/zapnap/resque_mailer/
More info: https://www.ruby-toolbox.com/projects/resque_mailer
It's pretty easy to set up.
More info:
http://blog.zerosum.org/2010/1/9/resque-mailer.html
http://www.scottw.com/simple-resque-mail-queue
http://ku1ik.com/2011/04/05/resque-mailer-says-put-your-emails-to-background.html