Module: HasEmails::Extensions::ActionMailer

Defined in:
lib/has_emails/extensions/action_mailer.rb

Overview

Adds support for queueing emails so that they can be procssed in the background. Emails are stored in the database using the Email ActiveRecord model.

Queueing mail

Once a mailer action and template are defined, you can queue your message for background processing like so:

Notifier.(john_smith) # Queues the email

If you were to deliver the mail immediately, the normal process would be used like so:

Notifier.(john_smith) # Delivers the email

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:


19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/has_emails/extensions/action_mailer.rb', line 19

def self.included(base) #:nodoc:
  base.class_eval do
    @@default_subject_prefix = "[#{File.basename(File.expand_path(Rails.root)).camelize}] "
    cattr_accessor :default_subject_prefix
    
    # Specify the prefix to use for the subject. This defaults to the
    # +default_subject_prefix+ specified for ActionMailer::Base.
    adv_attr_accessor :subject_prefix
    
    include HasEmails::Extensions::ActionMailer::InstanceMethods
    extend HasEmails::Extensions::ActionMailer::ClassMethods
  end
end