Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andersondias/delayed_job_mailer
Send emails asynchronously using delayed_job
https://github.com/andersondias/delayed_job_mailer
Last synced: 6 days ago
JSON representation
Send emails asynchronously using delayed_job
- Host: GitHub
- URL: https://github.com/andersondias/delayed_job_mailer
- Owner: andersondias
- License: mit
- Created: 2009-08-14T22:37:14.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-01-04T21:47:36.000Z (almost 15 years ago)
- Last Synced: 2024-11-02T00:32:47.873Z (13 days ago)
- Language: Ruby
- Homepage:
- Size: 80.1 KB
- Stars: 42
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: MIT-LICENSE
Awesome Lists containing this project
README
DelayedJobMailer
==============This plugin provides a module which - when included into an ActionMailer subclass - pushes all emails that would
normally be delivered synchronously into a queue for asynchronous processing. For queuing it relies on the delayed_job
plugin ( http://github.com/tobi/delayed_job ).How it works
============The plugin provides a module Delayed::Mailer. To make a mailer use a queue simply include it into the class like this:
class MyMailer < ActionMailer::Base
include Delayed::Mailer
endFrom now on all MyMailer.deliver_whatever_email calls create an entry delayed_job queue.
If you still want to deliver mail sycnhronously add a bang to the method call: MyMailer.deliver_whatever_email!To set asynchronous mailing as project default, you need to create an initializer file as follows:
# config/initializers/delayed_mailer.rb
class ActionMailer::Base
include Delayed::Mailer
endInstallation
============script/plugin install git://github.com/andersondias/delayed_job_mailer.git
Configuration
=============Delayed e-mails is an awesome thing in production environments, but for e-mail specs/tests in testing environments it can be a mess causing specs/tests to fail because the e-mail haven't been sent directly. Therefore you can configure what environments that should be excluded like so:
# config/initializers/delayed_mailer.rb
Delayed::Mailer.excluded_environments = [:test, :cucumber] # etc.
...
Credits
=======This plugin is a delayed job plugin based on langalex workling_mailer
plugin that can be found at http://github.com/langalex/workling_mailerContact
=======Copyright (c) 2009 Anderson Dias, released under the MIT license
Email: andersondaraujo[at]gmail.com
Twitter: extendsmymind
Blog: http://extendsmymind.wordpress.com