Sha256: 1ca382f5152332922c2b61e4f049fe4675e7a6d44dfa33cba346f77302d4f6d4
Contents?: true
Size: 933 Bytes
Versions: 1
Compression:
Stored size: 933 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 << "Used Memory: #{output.split(" ")[8]}\n" s << "Free Memory: #{output.split(" ")[9]}\n" rescue end s << "\npfa\n" s << "\n\nregards,\n" s << "Rake Mailer,\n" s end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rake_mailer-1.0.4 | lib/rake_mailer/mail_it.rb |