Sending all emails using delayed_job in Rails 3

126 views
Skip to first unread message

szimek

unread,
Mar 10, 2011, 10:07:06 AM3/10/11
to delay...@googlegroups.com
Hey,

would it be possible to overwrite Mail::Message#deliver method to always use delayed job? Maybe with some optional param to allow to skip delayed job. Anybody tried it?

Cheers,
Szymon

szimek

unread,
Mar 23, 2011, 4:40:44 AM3/23/11
to delay...@googlegroups.com
Hey,

I tried adding a new delivery_method that would act as a proxy for original delivery method, but would simply use #delay method, but I've got strange problem even with the simplest case when using e.g. :sendmail delivery method:

mail = UserMailer.welcome(user)
mail.delivery_method.delay.deliver!(mail) # delivery_method is :sendmail here

This creates the job correctly, but when I try to run it, I get the following error: 

Job failed to load: uninitialized constant Mail::ParameterHash + YAML serialized handler.

Any idea if it's possible to make it somehow work?
Reply all
Reply to author
Forward
0 new messages