Re-namespacing a bit to clear out some fairly old stuff from the top level

This commit is contained in:
Dan Buch
2013-01-22 19:10:10 -05:00
parent ab43fb0146
commit 92f7543872
485 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
require 'rubygems'
require 'action_mailer'
require 'mime/types'
class SimpleMailer < ActionMailer::Base
def directory_dump_message(recipient, directory)
from 'directory-dump@localhost'
recipients recipient
subject "Dump of #{directory}"
body %{Here are the files currently in "#{directory}":}
Dir.new(directory).each do |f|
path = File.join(directory, f)
if File.file? path
mime_type = MIME::Types.of(f).first
content_type = (mime_type ? mime_type.content_type :
'application/octet-stream')
attachments[f] = {
:mime_type => mime_type,
:encoding => ('quoted-printable' if content_type =~ /^text\//),
:content => File.read(path)
}
end
end
end
end
puts SimpleMailer.directory_dump_message('daniel.buch+rubytest@gmail.com',
'/tmp')