Class: Roma::Watch::Mailer
- Inherits:
-
Object
- Object
- Roma::Watch::Mailer
- Defined in:
- lib/roma/tools/roma_watcher.rb
Constant Summary collapse
- MAILER =
'/usr/lib/sendmail'
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#mailer ⇒ Object
readonly
Returns the value of attribute mailer.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from, to, mailer = nil) ⇒ Mailer
constructor
A new instance of Mailer.
- #send_mail(sub, msg) ⇒ Object
Constructor Details
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
21 22 23 |
# File 'lib/roma/tools/roma_watcher.rb', line 21 def from @from end |
#mailer ⇒ Object (readonly)
Returns the value of attribute mailer.
23 24 25 |
# File 'lib/roma/tools/roma_watcher.rb', line 23 def mailer @mailer end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
22 23 24 |
# File 'lib/roma/tools/roma_watcher.rb', line 22 def to @to end |
Instance Method Details
#send_mail(sub, msg) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/roma/tools/roma_watcher.rb', line 32 def send_mail(sub, msg) open("| #{@mailer} -f #{@from} -t", 'w') do |f| f.puts "From: #{@from}" f.puts "To: #{@to}" #f.puts "Subject: #{sub.tojis}" f.puts "Subject: #{sub}" f.puts "Reply-To: #{@from}" f.puts f.puts msg.tojis 2.times{ f.puts } f.puts "." end end |