class BuildMailer < ActionMailer::Base
  helper :application
  NOTIFICATIONS_EMAIL = 'kochiku-notifications@squareup.com'
  KOCHIKU_EMAIL = 'kochiku@squareup.com'

  default :from => KOCHIKU_EMAIL

  def time_out_email(build_attempt)
    @build_part = build_attempt.build_part
    @builder = build_attempt.builder
    mail(:to => NOTIFICATIONS_EMAIL, :subject => "[kochiku] Build part timed out")
  end

  def build_break_email(build)
    @build = build
    emails = GitBlame.emails_since_last_green(@build)
    @git_changes = GitBlame.changes_since_last_green(@build)
    @failed_build_parts = @build.build_parts.failed_or_errored

    mail(:to => emails,
         :bcc => NOTIFICATIONS_EMAIL,
         :subject => "[kochiku] #{@build.project.name} build for branch #{@build.branch} failed",
         :from => "build-and-release+#{@build.project.name.parameterize}@squareup.com")
  end
end

class BuildMailer < ActionMailer::Base
  helper :application
  NOTIFICATIONS_EMAIL = 'kochiku-notifications@squareup.com'
  KOCHIKU_EMAIL = 'build-and-release@squareup.com'

  default :from => KOCHIKU_EMAIL

  def time_out_email(build_attempt)
    @build_part = build_attempt.build_part
    @builder = build_attempt.builder
    mail :to => NOTIFICATIONS_EMAIL,
         :subject => "[kochiku] Build part timed out",
         :from => 'build-and-release+timeouts@squareup.com'
  end

  def build_break_email(build)
    @build = build
    emails = GitBlame.emails_since_last_green(@build)
    @git_changes = GitBlame.changes_since_last_green(@build)
    @failed_build_parts = @build.build_parts.failed_or_errored

    mail :to => emails,
         :bcc => NOTIFICATIONS_EMAIL,
         :subject => "[kochiku] #{@build.project.name} build for branch #{@build.branch} failed",
         :from => "build-and-release+#{@build.project.name.parameterize}@squareup.com"
  end
end

Send emails from an email that exists
Send emails from an email that exists

This seems to help them get through.

Also, remove kochiku@ as the default so our future selves don't repeat our mistakes.
