Class: Gwtf::Notifier::Email
- Inherits:
-
Base
- Object
- Base
- Gwtf::Notifier::Email
show all
- Defined in:
- lib/gwtf/notifier/email.rb
Instance Attribute Summary
Attributes inherited from Base
#item, #recipient
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Class Method Details
.send_email(body, subject, recipient) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/gwtf/notifier/email.rb', line 4
def self.send_email(body, subject, recipient)
tmp = Tempfile.new("gwtf")
tmp.write(body)
tmp.rewind
subject.gsub!("'", "\'")
recipient.gsub!("'", "\'")
system("cat #{tmp.path} | mail -s '#{subject}' '#{recipient}'")
ensure
tmp.close!
end
|
Instance Method Details
#notify ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/gwtf/notifier/email.rb', line 17
def notify
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
Email.send_email(item.summary, subject, recipient)
end
|