Sha256: aea0ae99d8a51cf01dcab0e5bfeffc919070106efc2979d6eaad8535b271067a

Contents?: true

Size: 814 Bytes

Versions: 21

Compression:

Stored size: 814 Bytes

Contents

class EmailNotify
  def self.logger
    @@logger ||= RAILS_DEFAULT_LOGGER || Logger.new(STDOUT)
  end

  def self.send_comment(comment, user)
    return if user.email.blank?

    begin
      email = NotificationMailer.create_comment(comment, user)
      EmailNotify.send_message(user,email)
    rescue => err
      logger.error "Unable to send comment email: #{err.inspect}"
    end
  end

  def self.send_article(article, user)
    return if user.email.blank?

    begin
      email = NotificationMailer.create_article(article, user)
      EmailNotify.send_message(user,email)
    rescue => err
      logger.error "Unable to send article email: #{err.inspect}"
    end
  end

  def self.send_message(user, email)
    email.content_type = "text/html; charset=utf-8"
    NotificationMailer.deliver(email)
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
typo-5.5 lib/email_notify.rb
typo-5.4.4 lib/email_notify.rb
typo-5.4.3 lib/email_notify.rb
typo-5.4.2 lib/email_notify.rb
typo-5.4.1 lib/email_notify.rb
typo-5.4 lib/email_notify.rb
typo-4.1.1 lib/email_notify.rb
typo-4.1 lib/email_notify.rb
typo-5.0.2 lib/email_notify.rb
typo-5.0.1 lib/email_notify.rb
typo-5.0.3.98.1 lib/email_notify.rb
typo-5.0.3.98 lib/email_notify.rb
typo-5.0 lib/email_notify.rb
typo-5.1.2 lib/email_notify.rb
typo-5.1.1 lib/email_notify.rb
typo-5.1.3 lib/email_notify.rb
typo-5.1.98 lib/email_notify.rb
typo-5.1 lib/email_notify.rb
typo-5.2.98 lib/email_notify.rb
typo-5.2 lib/email_notify.rb