require 'cerberus/publisher/base'

class Cerberus::Publisher::Gmailer < Cerberus::Publisher::Base
  def self.publish(state, manager, options)
    require 'gmailer'

    subject, body = Cerberus::Publisher::Base.formatted_message(state, manager, options)

    gopts = options[:publisher, :gmailer]
    recipients = options[:publisher, :gmailer, :recipients]
    GMailer.connect(gopts) do |g|
      success = g.send(:to => recipients, :subject => subject, :body => body)

      raise 'Unable to send mail using Gmailer' unless success
    end
  end
end
require 'cerberus/publisher/base'

class Cerberus::Publisher::Gmailer < Cerberus::Publisher::Base
  def self.publish(state, manager, options)
    require 'gmailer'

    subject, body = Cerberus::Publisher::Base.formatted_message(state, manager, options)

    gopts = options[:publisher, :gmailer]
    recipients = gopts[:recipients]
    GMailer.connect(gopts) do |g|
      success = g.send(:to => recipients, :subject => subject, :body => body, :from => gopts[:recipients])

      raise 'Unable to send mail using Gmailer' unless success
    end
  end
end
Use from option from configuration
Use from option from configuration


git-svn-id: fbbd53e748d1d9421100d69b79e89db6c5fd213c@166 65aa75ef-ce15-0410-bc34-cdc86d5f77e6
