mailcatcher/lib/mail_catcher/growl.rb

17 lines
426 B
Ruby
Raw Normal View History

2014-03-17 01:31:05 -04:00
require "mail_catcher/events"
2011-06-09 23:24:08 -04:00
module MailCatcher
module Growl extend self
2011-06-09 23:24:08 -04:00
def start
2014-03-17 01:31:05 -04:00
MailCatcher::Events::MessageAdded.subscribe(method(:notify))
2011-06-09 23:24:08 -04:00
end
def notify message
2014-03-17 01:31:05 -04:00
system "growlnotify",
"--image", File.expand_path(File.join(__FILE__, "../public/images/logo_large.png")),
"--name", "MailCatcher",
"--message", "Message received:\n#{message["subject"]}"
2011-06-09 23:24:08 -04:00
end
end
end