diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/action_mailer_basics.textile | 21 | ||||
-rw-r--r-- | guides/source/configuring.textile | 5 |
2 files changed, 11 insertions, 15 deletions
diff --git a/guides/source/action_mailer_basics.textile b/guides/source/action_mailer_basics.textile index 5f09b8e410..d92d5c48fb 100644 --- a/guides/source/action_mailer_basics.textile +++ b/guides/source/action_mailer_basics.textile @@ -472,7 +472,6 @@ The following configuration options are best made in one of the environment file |+delivery_method+|Defines a delivery method. Possible values are <tt>:smtp</tt> (default), <tt>:sendmail</tt>, <tt>:file</tt> and <tt>:test</tt>.| |+perform_deliveries+|Determines whether deliveries are actually carried out when the +deliver+ method is invoked on the Mail message. By default they are, but this can be turned off to help functional testing.| |+deliveries+|Keeps an array of all the emails sent out through the Action Mailer with delivery_method :test. Most useful for unit and functional testing.| -|+async+|Setting this flag will turn on asynchronous message sending, message rendering and delivery will be pushed to <tt>Rails.queue</tt> for processing.| |+default_options+|Allows you to set default values for the <tt>mail</tt> method options (<tt>:from</tt>, <tt>:reply_to</tt>, etc.).| h4. Example Action Mailer Configuration @@ -535,30 +534,22 @@ In the test we send the email and store the returned object in the +email+ varia h3. Asynchronous -You can turn on application-wide asynchronous message sending by adding to your <tt>config/application.rb</tt> file: +Rails provides a Synchronous Queue by default. If you want to use an Asynchronous one you will need to configure an async Queue provider like Resque. Queue providers are supposed to have a Railtie where they configure it's own async queue. -<ruby> -config.action_mailer.async = true -</ruby> +h4. Custom Queues -Alternatively you can turn on async within specific mailers: +If you need a different queue than <tt>Rails.queue</tt> for your mailer you can use <tt>ActionMailer::Base.queue=</tt>: <ruby> class WelcomeMailer < ActionMailer::Base - self.async = true + self.queue = MyQueue.new end </ruby> -h4. Custom Queues - -If you need a different queue than <tt>Rails.queue</tt> for your mailer you can override <tt>ActionMailer::Base#queue</tt>: +or adding to your <tt>config/environments/$RAILS_ENV.rb</tt>: <ruby> -class WelcomeMailer < ActionMailer::Base - def queue - MyQueue.new - end -end +config.action_mailer.queue = MyQueue.new </ruby> Your custom queue should expect a job that responds to <tt>#run</tt>. diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile index dd84754b22..73d6102eac 100644 --- a/guides/source/configuring.textile +++ b/guides/source/configuring.textile @@ -434,6 +434,11 @@ config.action_mailer.observers = ["MailObserver"] config.action_mailer.interceptors = ["MailInterceptor"] </ruby> +* +config.action_mailer.queue+ registers the queue that will be used to deliver the mail. +<ruby> +config.action_mailer.queue = SomeQueue.new +</ruby> + h4. Configuring Active Support There are a few configuration options available in Active Support: |