RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

resque-async_deliver: Easily send emails asynchronously with Resque

resque-async_deliver allows you to simply change SomeMailer.a_message(args).deliver to SomeMailer.async_deliver.a_message(args) and the mail will be queued in Resque and delivered asynchronously. No need for custom jobs.

Comments

@fphilipe, just curious, why not make SomeMailer.a_message(args).async_deliver as the syntax?

I’m more curious as to why these plugins don’t just queue by default. Its very rarely I want a request delayed for email delivery.

I have been using resque-mailer for some time, I like that the syntax does not have to change. https://github.com/zapnap/resque_mailer

@Micah: I first wanted to do it as you describe. The only problem with that is that the mail is actually generated when it won’t be further used.

@jon, @Michael: I considered using resque_mailer but I didn’t like that I had to include the module in the mailer. Further, I did not want to change the default behavior of #deliver. Coming from delayed_job where you simply call SomeMailer.delay.a_message I wanted to keep this syntax without having to change all the codebase and the habits.

That’s why I created this gem. I like the explicit verbosity and I think it’s also easy to read. Kinda like “Hey mailer, asynchronously deliver the welcome message”.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in