Class: Cms::EmailMessage

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
DefaultAccessible
Defined in:
app/models/cms/email_message.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.deliver!Object


14
15
16
17
18
19
# File 'app/models/cms/email_message.rb', line 14

def self.deliver!
  # Send all messages, 100 at a time
  undelivered.all(:limit => 100).each do |m|
    m.deliver!
  end
end

Instance Method Details

#deliver!Object


26
27
28
29
30
# File 'app/models/cms/email_message.rb', line 26

def deliver!
  return false if delivered?
  Cms::EmailMessageMailer.email_message(self).deliver
  update_attributes(:delivered_at => Time.now)
end

#deliver_nowObject

TODO: Take this out when we have an email queue processor


22
23
24
# File 'app/models/cms/email_message.rb', line 22

def deliver_now
  deliver!
end

#delivered?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'app/models/cms/email_message.rb', line 10

def delivered?
  !!delivered_at
end