Sha256: dca8329eedbd6cc638850313209e618c3146494662845e9058c9d147822379c1

Contents?: true

Size: 1.14 KB

Versions: 10

Compression:

Stored size: 1.14 KB

Contents

class ReaderNotifier < ActionMailer::Base

  radiant_layout lambda { Radiant::Config['email.layout'] || 'email'}
  
  def message(reader, message, sender=nil)
    site = reader.site if reader.respond_to?(:site)
    prefix = site ? site.abbreviation : Radiant::Config['email.prefix']
    host = site ? site.base_domain : Radiant::Config['site.host'] || 'www.example.com'
    default_url_options[:host] = host
    sender = Radiant::Config['email.name'] || "sender_not_configured"
    sender_address = Radiant::Config['email.address'] || "admin@#{host}"

    message_layout(message.layout) if message.layout
    content_type("text/html")
    subject (prefix || '') + message.subject
    recipients(reader.email)
    from ["#{sender} <#{sender_address}>"]
    reply_to = [sender_address]
    subject message.subject
    sent_on(Time.now)

    body({
      :host => host,
      :title => message.subject,
      :message => message.filtered_body,
      :sender => sender,
      :reply_to => sender_address,
      :reader => reader,
      :site => site || {
        :name => Radiant::Config['site.name'],
        :url => Radiant::Config['site.host']
      }
    })
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
radiant-reader-extension-1.3.13 app/models/reader_notifier.rb
radiant-reader-extension-1.3.12 app/models/reader_notifier.rb
radiant-reader-extension-1.3.11 app/models/reader_notifier.rb
radiant-reader-extension-1.3.10 app/models/reader_notifier.rb
radiant-reader-extension-1.3.9 app/models/reader_notifier.rb
radiant-reader-extension-1.3.8 app/models/reader_notifier.rb
radiant-reader-extension-1.3.7 app/models/reader_notifier.rb
radiant-reader-extension-1.3.6 app/models/reader_notifier.rb
radiant-reader-extension-1.3.4 app/models/reader_notifier.rb
radiant-reader-extension-1.3.3 app/models/reader_notifier.rb