Sha256: 6ebdecda707902555906a6aa31b193f1af7f3a4dec54c0d1431dac52418adc61
Contents?: true
Size: 1.6 KB
Versions: 4
Compression:
Stored size: 1.6 KB
Contents
require 'action_mailer' require 'damagecontrol/publisher/base' module DamageControl module Publisher class Email < Base register self attr_accessor :enabled ann :description => "How to deliver email [\"sendmail\"|\"smtp\"]" attr_accessor :delivery_method ann :description => "Recipients (comma separated)" attr_accessor :to ann :description => "Who sends the email" attr_accessor :from def initialize @delivery_method = "sendmail" @to = "" @from = "\"DamageControl\" <dcontrol@codehaus.org>" end def name "Email" end def publish(build) BuildMailer.template_root = File.expand_path(File.dirname(__FILE__) + "/../../../app/views") BuildMailer.delivery_method = @delivery_method BuildMailer.deliver_email(build, self) end end class BuildMailer < ActionMailer::Base def email(build, email_publisher, foo=nil, bar=nil) @delivery_method = email_publisher.delivery_method Log.info("Sending email to #{email_publisher.to.inspect} via #{@delivery_method}") @recipients = email_publisher.to.split(%r{,\s*}) @from = email_publisher.from @subject = "#{build.project.name} Build #{build.status_message}" @sent_on = Time.new.utc @headers['Content-Type'] = "text/html" @body["build"] = build end # We have to define this, since our name is used to find the email template class << self def to_s "Build" end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems