Class: Gwtf::Notifier::Email

Inherits:
Base
  • Object
show all
Defined in:
lib/gwtf/notifier/email.rb

Instance Attribute Summary

Attributes inherited from Base

#item, #recipient

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gwtf::Notifier::Base

Instance Method Details

#notifyObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gwtf/notifier/email.rb', line 4

def notify
  begin
    tmp = Tempfile.new("gwtf")
    tmp.write(item.summary)
    tmp.rewind

    if item.project == "default"
      subject = "Reminder for item %s" % [ item.item_id ]
    else
      subject = "Reminder for item %s in %s project" % [ item.item_id, item.project ]
    end

    system("cat #{tmp.path} | mail -s '#{subject}' '#{recipient}'")
  ensure
    tmp.close
    tmp.unlink
  end
end