Sha256: 15915e0cf18afc57b15457c901aa9d521c76a483aa975d98d83f06e6ecae9f12

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

require 'socket'
module RakeMailer
  class MailIt < ActionMailer::Base
    def custom_text_email(from, to, file_location, filename, subject)
      attachments[filename] = File.read(file_location)
      mail :from => from,
           :to => to,
           :subject => subject do |format|
        format.text { render text: body_text }
      end
    end
    private
    def body_text
      s = ''
      s << "IP: #{Socket.ip_address_list.find {|a| !(a.ipv4_loopback?) }.ip_address}\n"
      s << "Host Name: #{Socket.gethostname}\n"
      s << "User: #{ENV['USERNAME']}\n"
      s << "Time: #{Time.now}\n"
      begin
        output = %x(free)
        s << "Total Memory: #{output.split(" ")[7]}\n"
        s << "User Memory: #{output.split(" ")[8]}\n"
        s << "Free Memory: #{output.split(" ")[9]}\n"
      rescue
      end
      s << "pfa\n"
      s
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rake_mailer-1.0.3 lib/rake_mailer/mail_it.rb