Sha256: d97b78cd98d76aff9f484591a70a3ba7667301f6187114799f987d28d7f765e3

Contents?: true

Size: 546 Bytes

Versions: 5

Compression:

Stored size: 546 Bytes

Contents

require 'mail'
require "socket"

class ErrorMail
  
  def self.setup from = ENV['USER'],to = "root",mail_options = {}
    
    Keepitsafe.on_error do |backup,options|

      mail = MailBuilder.new("#{File.dirname(__FILE__)}/../email/error").build({:backup => backup})
      mail.from from
      mail.to to
      mail.subject "[#{backup.domain}] Backup ERROR!"
      mail.delivery_method.settings = mail.delivery_method.settings.merge(mail_options)
      mail.deliver!

      puts "\nError has been mailed to #{mail.to}!"
    end
    
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
keepitsafe-0.2.6 lib/error_mail.rb
keepitsafe-0.2.5 lib/error_mail.rb
keepitsafe-0.2.4 lib/error_mail.rb
keepitsafe-0.2.3 lib/error_mail.rb
keepitsafe-0.2.2 lib/error_mail.rb